Last active
March 5, 2017 20:39
-
-
Save mcarbonneaux/fe5474692f18beb12b3936c50d7c2bf2 to your computer and use it in GitHub Desktop.
PHP Json Resume render.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$resume_time = lstat("resume.json"); | |
if ( is_array($resume_time) ) | |
{ | |
$resume_mt=gmdate('D, d M Y H:i:s ', $resume_time["mtime"]) . 'GMT'; | |
$if_modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? $_SERVER['HTTP_IF_MODIFIED_SINCE'] : false; | |
if (($if_modified_since && $if_modified_since == $resume_mt)) | |
{ | |
header('HTTP/1.1 304 Not Modified'); | |
exit(); | |
} | |
else | |
{ | |
header("Last-Modified: $resume_mt"); | |
} | |
} | |
$resume=json_decode(file_get_contents("resume.json")); | |
$data=array("resume"=>$resume); | |
$data_post=json_encode($data); | |
$theme="sceptile"; | |
if (isset($_GET["theme"])) $theme=$_GET["theme"]; | |
$url = 'https://themes.jsonresume.org/'.$theme; | |
$options = array( | |
'http' => array( | |
'header' => "content-type: application/json\r\n", | |
'method' => 'POST', | |
'content' => $data_post, | |
) | |
); | |
$context = stream_context_create($options); | |
$result = file_get_contents($url, false, $context); | |
print($result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Render
resume.json
JSON Resume (https://jsonresume.org/) with this php script.The
resume.json
file must be in the same directory that this index.php.This script support
theme
argument to change defaulttheme
to render.