CakePHP HAML template engine
PHP
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Config
View
README.md
composer.json

README.md

CakePHP HAML views class

Latest Stable Version Total Downloads Latest Unstable Version License

HAML template engine for CakePHP 2.x.

Based on the MtHaml, a HAML implementation for PHP.

Installation

Include the plugin on your composer file:

{
  "require": {
    "tiutalk/haml": "dev-master"
  }
}

This package has a Composer dependency, don't forget to require autoload.php and then enable it on the APP/Config/bootstrap.php file:

<?php
require_once APP . 'Vendor' . DS . 'autoload.php';

CakePlugin::load('Haml', array('bootstrap' => true));

Usage

Set the default ViewClass on the APP/Controller/AppController.php file:

<?php
class AppController extends Controller {

  public $viewClass = 'Haml.Haml';

}

And now you can use HAML on all your view files with .haml extension.

Examples

APP/View/Layouts/default.ctp

!!!
%html
  %head
    %title= $title_for_layout
    %meta{ :content => "", :name => "description" }
    %meta{ :content => "", :name => "author" }

    = $this->Html->css('cake.generic')
    = $this->fetch('css')
    = $this->fetch('script')
  %body
    #container
      #header
        %h1 CakePHP

      #content
        = $this->Session->flash()
        = $this->fetch('content')

      #footer
        = $this->Html->link($this->Html->image('cake.power.gif'), 'http://www.cakephp.org/', array('target' => '_blank', 'escape' => false))