You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
svallory edited this page Jul 5, 2012
·
2 revisions
The simplest way to use HamlPHP is to manually. You can use mod_rewrite to redirect all your requests to index.php and render the .haml files from there. We'll add this example later. HamlPHP will cache compilation results, so the .haml file is only compiled to php once.
<?phprequire_once'src/HamlPHP/HamlPHP.php';
require_once'src/HamlPHP/Storage/FileStorage.php';
// Make sure that a directory _tmp_ exists in your application and it is writable.$parser = newHamlPHP(newFileStorage(dirname(__FILE__) . '/tmp/'));
$content = $parser->parseFile('index.haml');
echo$content;