Created
June 24, 2013 14:36
-
-
Save svallory/5850495 to your computer and use it in GitHub Desktop.
How to render a partial using HamlPHP
This file contains hidden or 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 | |
// WARNING: This is the simplest possible example. It could be vastly improved | |
// by keeping the HamlPHP instance somewhere and, even more important, caching parser results | |
function render_partial($file, $data) { | |
$parser = new HamlPHP(new FileStorage('path/to/tmp/')); | |
$content = $parser->parseFile($file); | |
echo $parser->evaluateFile($content, $data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment