Modules templates

Module template – it is a set of files in the folder modules/module_name/views.

Module templates are responsible for the design of a modular display information in the main content area of ​​the site. This lists the news, products, files, photos, as well as individual article pages, card products, blocks of Polls, feedback form, etc.

Typically, the module template files as follows:

  • module_name.view.first_page.php – the main (first) page of the module;
  • module_name.view.list.php – a list of elements of the module;
  • module_name.view.id.php – page is a separate element;
  • module_name.view.form.php – form to fill (if an on-line);
  • module_name.view.show_block.php – block.

Example:

Online store catalog front page template will file modules/shop/views/shop.view.first_page.php, and a list of news – modules/news/views/news.view.list.php.

Making the appearance of the product cards in the file modules/shop/views/shop.view.id.php.

A design feedback forms will be in the template modules/feedback/views/feedback.view.form.php.

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

Example:

If you want to change the appearance of the block surveys on the site, then you need to make changes to the template module polls: modules/votes/views/votes.view.show_block.php

Including the template is as follows:

Example:

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

where $result – passed to the data in an array pattern.

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

Example:

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

The template can cause the module template tag. For this purpose it is necessary to process function htmleditor().

Example:

echo $this->htmleditor('<insert name="show_block" module="site" id="13">');

Also, all data entered via the visual editor, you want to handle with this function.

Example:

// in file modules/news/news.model.php
$row["text"] = $this->diafan->_tpl->htmleditor($row["text"]);