phammable.tar.bz2 (v0.8.5, 31st December 2008) 14.9kB
HAML-Textmate.tar.bz2 (0.9kB)
The best way to install Phammable is to put its files in a directory PHP can execute files from AND write to, but which is outside of your site's document root. For this website, the directory structure is as follows:
/www/ ├ classes/ ├ haml/ | ├ HAML.php | ├ HAML_here.php | └ [cache folders] ├ phammable.org/ └ [other domains on this host]
To install Phammable to a similar location on your server, do the following:
# Create the directory$ mkdir haml# Extract the HAML files here, THEN set permissions:$ chmod -R 0744 haml# Replace "apache" with the user and group name for PHP! chown -R apache:apache haml
Warning:
short_open_tag
must
be set to
Off
in your
php.ini
file, or PHP will crash on Phammable documents' XML doctype. The feature is deprecated anyway, and should not be used.
At this point, you can include files by calling
include haml('myFile.haml');
from any PHP file on your site. Phammable should create any necessary subdirectories to store its cached PHP files in, and the return value of the
haml
function will be the absolute pathname of the generated PHP file. This path is passed to
include
, which results in its content being output. Any statements following this line will still be executed; If you want to halt execution, use
die()
or
exit()
.
To have HAML files handled automatically (as they are on this server) so that the URL of a HAML page is simply that file's name, you can have the
HAML_here.php
script run whenever a file is requested. Technically, the script is run
instead of
the requested HAML file, because
HAML_here
includes the compiled version of the file and then calls
die
before PHP tries to interpret the HAML source.
Simply add the appropriate lines to your
httpd.conf
file:
<Files *.haml> ForceType application/x-httpd-php php_value auto_prepend_file /www/haml/HAML_here.php </Files>