tiutalk/haml

CakePHP HAML template engine

This package's canonical repository appears to be gone and the package has been frozen as a result.

Maintainers

Details

github.com/TiuTalk/haml

Installs: 12 166

Dependents: 0

Suggesters: 0

Security: 0

Stars: 17

Watchers: 4

Forks: 2

Type:cakephp-plugin

dev-master 2015-09-29 05:15 UTC

This package is not auto-updated.

Last update: 2024-01-18 05:23:19 UTC


README

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))