Smarty Custom Templates

You can create your own templates, which replace the standard ones (such as EditView.tpl and so on). The new template is used if $_REQUEST values of the page meet the requirements. The registration of a new template is done through the method:

SDK::setSmartyTemplate($params, $src);

$params : associative array with requirements (see below)
$src : path of the new template

In the $params variable you can specify a special value ("$NOTNULL$") to indicate that this parameter must exist, with any value. The unspecified parameters are ignored. If the rule to be inserted already exists or is not compatible with the existing ones (it could cause ambiguity for some $_REQUEST), the insertion fails (and an explanatory message is saved in the log).

To remove the customization:

SDK::unsetSmartyTemplate($params, $src = NULL);

$params : associative array with requirements
$src : path of the template (if NULL, it includes all file)

To completely replace all types of views of a module you need at least 7 rules:

$params Notes
array(‘module’=>’Leads’, ‘action’=>’ListView’) ListView
array(‘module’=>’Leads’, ‘action’=>’index’) ListView
array(‘module’=>’Leads’, ‘action’=>’DetailView’ , ‘record’=>’$NOTNULL$’) DetailView
array(‘module’=>’Leads’, ‘action’=>’EditView’ , ‘record’=>’$NOTNULL$’) EditView (with record in $_REQUEST)
array(‘module’=>’Leads’, ‘action’=>’EditView’) New record
array(‘module’=>’Leads’, ‘action’=>’EditView’, ‘record’=>’$NOTNULL$’, "isDuplicate"=>"true") Duplicate record
array(‘module’=>’Leads’, ‘action’=>’LeadsAjax’, ‘record’=>’$NOTNULL$’, 'ajxaction'=>'LOADRELATEDLIST', 'header'=>'Products') The related list of leads showing the products

If multiple rules match, the most specific will be used. For example, if there are 2 rules, one with "$NOTNULL$" and one with the value "Leads" and the request is "Leads", the second rule will be used.


Back to top