Skip to content
dongbeta edited this page Jul 28, 2011 · 2 revisions

Xoops Engin use smarty as the template renderer.

How to assign variables from action to template

The controller providers a view helper to assign variables to template. You don't need to know what a view helper is.

class Demo_IndexController extends Xoops_Zend_Controller_Action
{
    public function indexAction()
    {
        $data = 'Welcome to Xoops!';
        $this->template->assign('aString', $data);
    }
}

Then, you can use a variable named as aString in the template.

Where are the template files

All the template files are put at the directory templates under the application root. The file name is composed as {Controller}_{action}.html .

using smarty

The template will be compiled by the smary engine. The delimiters using by Xoops Engine is <{ and }>. So, continue the example above, here is the code in the template:

<div class="example">
    <{$aString}>
</div>

The output is:

<div class="example">
    Welcome to Xoops!
</div>