CakePHP view helper to construct HTML easily

Installs: 1

Dependents: 0

Stars: 12

Watchers: 2

Forks: 1

Type: cakephp-plugin

v2.0.0 2012-12-28 04:59 UTC


MarkupHelper allows you to build complex (X)HTML by fluent interface.

echo $this->Markup->div('class1')
    ->p->text('Hello world')->end


  • PHP 5.2.8 or later
  • CakePHP 2.0


cd app/Plugin/
git clone git:// Markup

I recommend you to checkout a versioning tag rather than a development branch.

cd app/Plugin/Markup
git checkout x.y.z.w


Load Markup.Markup in your controllers.

class AppController extends Controller {
    public $helpers = array('Markup.Markup');

And then, you can write (X)HTML with method chaining.

echo $this->Markup->div('class1')
    ->p->text('Hello world')->end

Other helpers methods are also available in method chains.

//The prefix f_ is FormHelper, h_ is HtmlHelper,
//and <HelperName>_ is <HelperName>Helper.
echo $this->Markup
    ->h_link('Forget password?', array('action' => 'forget'))

Check Syntax Guide for more details about the plugin syntax.