Template

Module templates – files in the folder modules/module_name/views. File name must be modules/module_name/views/module_name.view.template_name.php.

Typically, the composition of the following files:

  • module_name.view.form.php – displays the form. For example, in the module "Question-Answer" form to send a question;
  • module_name.view.list.php – displays item list. For example, in the module "News" – list of news;
  • module_name.view.first_page.php – displays module main page;
  • module_name.view.id.php – displays separate item in the user part. For example, a separate news in the module "News"; or a separate product in the module "Online shop";
  • module_name.view.show_block.php – displays a template function module. For example, the module "News", the output of news blocks for template tag show_block.

The template may be other files that reflect the individual characteristics of the module.

Connecting the template of the controller is as follows:

Example:

echo $this->diafan->_tpl->get('template_name', 'module_name', $result);

where $result – transmitted in template data as an array, derived from the model.

The template to call another template, you can use the short form:

Example:

echo $this->get('template_name', 'module_name', $result);

Example:

/* output template "Buy" button shop.view.buy_form
from product page template shop.view.id */
echo $this->get('buy_form', 'shop', array("row" => $result, "result" => $result));

The template can be displayed the template tag using function htmleditor.

Example:

// output dynamic block
// in the template modules/news/views/news.view.id.php
echo $this->htmleditor('<insert name="show_dynamic" module="site" id="1">');