Skip to content

Wordpress plugin based on wp-haml and HamlPHP which allows template creation using haml.

License

Notifications You must be signed in to change notification settings

hamlphp/wp-hamlphp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WP-HamlPHP (based on dxt/wp-haml and WP-HamlPHP)

This is still in development and not ready for use. Use at your own risk

WP-HamlPHP allows you to use HAML (powered by hamlphp/HamlPHP) in your templates, instead of embedded PHP — which always turns into a horrible mess as soon as your application is more complicated than “Hello World”.

It’s powered by hamlphp/HamlPHP, which is a port of HAML, as developed for use with Ruby on Rails. http://github.com/hamlphp/HamlPHP

WP-HamlPHP should work seamlessly with themes that don’t support it. When your theme’s templates are being loaded, WP-HAML will look for a file named .haml (eg: search.haml, comments.haml) and, if one is found, it will look for a cached version, if no cached version is found or it’s outdated, it will load and execute the template, bypassing Wordpress’s normal template loader.

If no .haml.php file is found, WP-HamlPHP will return control to the Wordpress template loader, which will load the original template file.

The upshot: You can leave WP-HamlPHP enabled for themes which don’t support it, and you can use it to implement bits of HAML in a theme that is otherwise normal. It should be pretty easy to port your theme to HAML in your spare time!

HOW DOES IT WORK?

  1. Request comes in, and is passed to template loader
  2. Plugin intercepts reqest and checks to see if there’s a matching haml template
  3. If there is, the compiled-templates folder is checked to see if it has already been compiled. If it has, it is executed immediately
  4. If it hasn’t, or the compiled version is outdated, the HAML is parsed, converted to embedded PHP which is savedto the compiled-templates folder and executed

The compiled templates aren’t static files: they’re PHP scripts, so WP-HamlPHP shouldn’t intefere with any cacheing plugins that you may be using.

h2.INSTALLATION AND SETUP

  1. Create a directory named ‘templates’ in the root of your theme directory. This is where you HAML templates will be stored.
  2. Create a directory named ‘partials’ in the HAML template directory.

FEEDBACK AND HELP

Please visit http://hamlphp.lighthouseapp.com

About

Wordpress plugin based on wp-haml and HamlPHP which allows template creation using haml.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages