praux.com API October 28, 2009

If you havn’t seen praux.com‘s fancy API, you should definitely have a look. Here’s an interface I put together that uses the API to display praux-hosted resumes on your own site. Praux is a new site that allows you to assemble, maintain and share your resume with others. The REST design and personal URLs at Praux allow you to reference, export and display your resume in many different ways. Here’s some code that uses the YAML feed of your praux.com resume, to render it on your own site. You will need the spyc YAML parser to use the below script. Have fun!
<? require_once("spyc.php"); $data = file_get_contents("http://your.url.praux.com/yaml/"); $resume = spyc_load_file($data); echo "<b>" . $resume[name] . "</b><br>"; echo "<b>" . $resume[email] . "</b><br>"; echo "<b>" . $resume[phone] . "</b><br><br>"; $sections = $resume[sections]; function recurse_child($child,$level=0,$lastout=false,$subsection=0) { $level++; if ($lastout==false) { $level--; } if (is_array($child)) { foreach ($child as $itemid => $item) { if (is_array($item[content_items])) { if ($item[content_items][0][body]) { echo "<span style='display:inline;position:relative;left:120px;'>"; echo str_repeat(" ",$level*8); echo "</span>"; echo "<div style='display:inline;position:relative;left:135px;'>"; echo "<span style='position:absolute;left:-15px;font-size:1.0em;'>"; echo "•"; echo "</span>"; echo trim($item[content_items][0][body]); echo "</div>"; echo "<br>\n"; $lastout=true; } if ($item[content_items][0][date_range]) { if ($subsection > 0) { echo "<br>"; } $subsection++; echo $item[content_items][0][date_range] . " "; echo "<span style='position:absolute;left:120px;'>"; if ($item[content_items][0][organization]) { echo "<b><i>" . $item[content_items][0][organization] . "</i></b>, "; } else { echo "<b><i>" . $item[content_items][0][title] . "</i></b>, "; } echo $item[content_items][0][locality]; echo "</span><br>"; echo "<span style='position:absolute;left:120px;'>"; echo $item[content_items][0][title]; echo "</span><br>"; } if (is_array($item[children])) { recurse_child($item[children],$level,$lastout,$subsection); } } } } } echo "<div style='position:absolute;width:600px;'>"; foreach ($resume[sections] as $sectionid => $section) { foreach ($section[content_blocks] as $blockid => $block) { echo "<span style='font-size:1.5em;'>" . $block[content_items][0][body] . "</span>"; echo "<span style='position:relative;'><hr></span><br>\n"; foreach ($block as $childid => $child) { recurse_child($child); } echo "<br>"; } } echo "</div>"; ?>
Rob,
Thanks for publishing this code! It’s a great example of how much flexibility hosting your resume on Praux.com affords you! Also, for people who don’t like the basic Praux.com formatting, this is a great template for people who want to hack up the generated HTML however they’d like it!