[ERROR#1] Template — Documentation — DIAFAN.CMS


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:


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:


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


/* 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.


// output dynamic block
// in the template modules/news/views/news.view.id.php
echo $this->htmleditor('<insert name="show_dynamic" module="site" id="1">');
Methods with the same name as their class will not be constructors in a future version of PHP; Markdown_Parser has a deprecated constructor
#1 include_once() called at [/var/www/diafan/data/www/diafancms.com/modules/docs/docs.model.php:499]
#2 Docs_model->prepare_text( 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 fi...) called at [/var/www/diafan/data/www/diafancms.com/modules/docs/docs.model.php:94]
#3 Docs_model->show() called at [/var/www/diafan/data/www/diafancms.com/modules/docs/docs.php:29]
#4 Docs->init() called at [/var/www/diafan/data/www/diafancms.com/includes/init.php:474]
#5 Init->module() called at [/var/www/diafan/data/www/diafancms.com/includes/init.php:119]
#6 Init->start() called at [/var/www/diafan/data/www/diafancms.com/index.php:62]