1.8.1. Overview

Helpers are invokable objects that generate HTML for you. You can address them as methods on $this in PHP template code, or by just the helper name when using Qiq syntax.

PHP syntax:

<?= $this->anchor('http://qiqphp.com', 'Qiq for PHP') ?>

Qiq syntax:

{{= anchor ('http://qiqphp.com', 'Qiq for PHP') }}

Both generate this HTML:

<a href="http://qiqphp.com">Qiq for PHP</a>

Qiq comes with a comprehensive set of helpers for general use, and for building forms. You can also create your own custom helpers.

Further, you can call any public or protected Template method from the template code. (This is because the template code is executed "inside" the Template object.) Among other things, you can set the layout, or render other templates, from inside any template:

{{ setLayout ('seasonal-layout') }}

{{= render ('some/other/template') }}