/HamlPHP

Yet another Haml to HTML converter written in PHP.

Primary LanguagePHPMIT LicenseMIT

HamlPHP

Yet another Haml to HTML converter written in PHP.

NOTE: The ownership of this repository has been moved to https://github.com/hamlphp/HamlPHP.

Requirements

PHP 5.2 or newer.

Usage

index.haml

!!! 5
%html
    %body
        #container
            %ul.navigation
                %li Etusivu
                %li Tuotteet
            
            %h2 Tuotteet
            %ul.products 
                %li= 1 * 6
                - for ($i = 0; $i < 10; $i++)
                    %li= $i + 3

In your index.php

<?php

require_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 = new HamlPHP(new FileStorage(dirname(__FILE__) . '/tmp/'));

$content = $parser->parseFile('index.haml');

echo $content;