Phammable.org

This site is dedicated to my HAML parser / integration framework for PHP, called Phammable. HAML is a shorthand markup language that makes it easy to structure complex documents in a legible, manageable way. The Phammable preprocessor for PHP transforms the concise syntax of HAML into valid, exectutable PHP files simply and transparently. Phammable understands a very slightly different syntax, mostly because PHP is so different from Ruby (which HAML was originally implemented on).

Phammable is a static preprocessor, not a runtime object. This means that the code it produces runs as fast as the equivalent "Jumble" of PHP and HTML, but it is much quicker to write and easier to maintain. After the first time the page is accessed, the generated PHP file persists and is used until the original file is modified.

Using HAML documents with Phammable is as simple as include haml('file.haml'); . It is even simpler than that for Apache users, since an entry like this in httpd.conf can be used to handle HAML files transparently:

<Files *.haml>
  ForceType application/x-httpd-php
  php_value auto_prepend_file /www/haml/HAML_here.php
</Files>

In fact, here's the HAML code for this page: (Indentation denotes structure)

!!! 1.1
%html{xmlns=http://www.w3.org/1999/xhtml xml:lang=en}
|→%head
|→|→%title Phammable.org
|→|→%link{title='Default Style' rel=stylesheet type=text/css media=screen}@index.css
|→%body
|→|→#rootElement{style=width:100%}
|→|→|→%h1 Phammable.org
|→|→|→& menu.haml
|→|→|→#Main
|→|→|→|→%p
|→|→|→|→|→This site is dedicated to my HAML parser / integration framework for PHP, called Phammable.
|→|→|→|→|→%a{title='Original HAML Homepage'}@http://haml.hamptoncatlin.com/ HAML
|→|→|→|→|→is a shorthand markup language that makes it easy to structure complex documents in a legible,
manageable way. The Phammable preprocessor for PHP transforms the concise syntax of HAML into
valid, exectutable PHP files simply and transparently. Phammable understands a very slightly
different syntax, mostly because PHP is so different from Ruby (which HAML was originally
implemented on).
|→|→|→|→%p
|→|→|→|→|→Phammable is a static preprocessor, not a runtime object. This means that the code it
produces runs as fast as the equivalent "Jumble" of PHP and HTML, but it is much quicker to write
and easier to maintain. After the first time the page is accessed, the generated PHP file persists
and is used until the original file is modified.
|→|→|→|→%p
|→|→|→|→|→Using HAML documents with Phammable is as simple as
|→|→|→|→|→%code include haml('file.haml');
|→|→|→|→|→. It is even simpler than that for Apache users, since an entry like this in httpd.conf can
be used to handle HAML files transparently:
|→|→|→|→%pre.center
|→|→|→|→|→<Files *.haml>
|→|→|→|→|→|→ForceType application/x-httpd-php
|→|→|→|→|→|→php_value auto_prepend_file /www/haml/HAML_here.php
|→|→|→|→|→</Files>
|→|→|→|→%p In fact, here's the HAML code for this page: (Indentation denotes structure)
|→|→|→|→%pre.center
|→|→|→|→|→- function greyIndent($tabs)
|→|→|→|→|→|→- return "<span style='color:#ccc'>".str_repeat('|→', strlen($tabs[0]))."</span>";
|→|→|→|→|→- $code = xmlentities(wordwrap(file_get_contents('index.haml'), 100), true);
|→|→|→|→|→= preg_replace_callback('~\t+~', 'greyIndent', $code);
|→|→|→|→|→%a@in_textmate.png See a screenshot of colored syntax in TextMate
|→|→|→|→%p
|→|→|→|→|→If you have questions or comments regarding Phammable,
|→|→|→|→|→please contact me at phammable at jyopp dot com.
|→|→|→%a@http://validator.w3.org/check?uri=referer
|→|→|→|→%img{alt='Valid XHTML 1.1' height=31 width=88}@http://www.w3.org/Icons/valid-xhtml11-blue
See a screenshot of colored syntax in TextMate

If you have questions or comments regarding Phammable, please contact me at phammable at jyopp dot com.

Valid XHTML 1.1