Giter VIP home page Giter VIP logo

wp-haml's Introduction

WP-HAML 1.0
------------

WP-HAML allows you to use HAML (powered by PHP-HAML) 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 PHP-HAML, which is a port of HAML, as developed for use with 
Ruby on Rails. The official distribution is a few years old, and has some bugs,
so we've forked it and put the source on github:

   http://github.com/dxw/phphaml
   
WP-HAML 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 
<template>.haml.php (eg: search.haml.php, comments.haml.php) and, if one is 
found, will load and execute the template, bypassing Wordpress's normal
template loader.

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

The upshot: You can leave WP-HAML 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, the HAML is parsed, converted to embedded PHP which is saved
   to the compiled-templates folder and executed
   
The compiled templates aren't static files: they're PHP scripts, so WP-HAML
shouldn't intefere with any cacheing plugins that you may be using.


VERY ANNOYING THING
--------------------

php-haml has no error checking or reporting at all. It will take whatever you
give it, and compile it to an embedded PHP file, even if it's totally broken.
Sometimes, if you give it something really left-field, you'll get an error 
within the parser itself.

This is obviously very bad. Suggestions for replacement parsers (or patches!) 
would be most welcome.

In practice, it's not *that* hard to work around. Create your theme with 
WP_DEBUG set to true (in wp-config.php) and check the compiled template when
you get a PHP error. It's usually fairly obvious what went wrong and how to
fix it.


FEEDBACK AND HELP
-----------------

First, check the website: http://github.com/dxw/wp-haml

If you can't find what you need, get in touch. I can't guarantee to support any 
of this, but pop me an email on [email protected], or visit us in 
#dextrousweb on Freenode. We'll see what we can do.

wp-haml's People

Contributors

holizz avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.