- PHAML
Infobox_Software
name = pHAML
developer = David Moring
latest_release_version = 0.9 (preview release)
latest_release_date =August 4 ,2007
operating_system =Cross-platform
genre =Template Engine
license =MIT License
website = [http://i.cloudi.us/phaml/ i.cloudi.us]pHAML (php XHTML Abstraction Markup Language) is a
PHP -centric variant ofHaml .Haml is a markup language that is used to cleanly and simply describe theXHTML of anyweb document without the use of traditional inline coding.pHAML adds additional PHP capabilities to Haml, beyond those provided by
phpHaml , including template inclusion, variable inclusion, debugging capabilities that have proven valuable and time savings in development. pHAML is live software in production in several sites.pHAML and Haml Similarities
There is no greater fan of the principles behind HAML than pHAML, markup should be beautiful, DRY (don't repeat yourself), well-indented, and the XHTML structure should be clear.
* The tag creating syntax was kept the same.
* Spaces are VERY important—tabs and spaces are not equal and may produce “interesting” results (hence the addition of the debugging capability).pHAML and Haml Differences
This solution was created to enhance Smarty, and also can be integrated into the Zend Framework. There have been other tweaks to assist in the creation of code. Also, PHP and Ruby share a bit, but are a bit different as well.
* Attributes are literal: there is no Ruby array notation for attribute arrays.
* Spaces are not tied to a multiple of two (fight the man!!), but you should make your code spacing consistent in practice.
* There are comments (not just the HTML kind).
* There is no Ruby code integration.
* There is PHP integration.
* There are debugging commands, a simple template system, heredoc syntax, html character output, and html4 doctype tags.
* Smarty integration.
* Zend Framework integration.
* All in a compact single PHP class.Examples
Example of Code
The pHAML Code
!!!%html %head %title Hello World %body %b Hello WorldGenerated Template:1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">2 <html>3 <head>4 <title>5 Hello World6 </title>7 </head>8 <body>9 <b>10 Hello World11 </b>12 </body>13 </html>14"The HTML output listing with line numbers is a function in the Zend Framework View that is under testing and will be release with the 1.0 version."
Example with Embedded Debugger On
By simply starting a line with a '?', the class will produce HTML comments that are useful in debugging.
?!!!%html %head %title Hello World %body %b Hello WorldGenerated Template:1 <!-- Debug on -->2 <!-- 3:4{!!!}: !!! -->3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">4 <!-- 4:4: %html -->5 <html>6 <!-- 5:6: %head -->7 <head>8 <!-- 6:8: %title Hello World -->9 <title>10 Hello World11 <!-- 7:6: %body -->12 </title>13 </head>14 <body>15 <!-- 8:8: %b Hello World -->16 <b>17 Hello World18 </b>19 </body>20 </html>21Current Status
Technical preview is available at Source Forge, [http://phaml.sourceforge.net Source Forge Site] .
External links
* [http://i.cloudi.us/phaml/documentation Documentation]
Wikimedia Foundation. 2010.