Theme view helpers and modifiers
Notando eCommerce template engine is based on Smarty template engine with ability of using Zend View helpers. You can use the functionality that you prefer, or both.
All Smarty template engine features such as: varaible modifiers, built-in and custom functions are available. They described at Smarty template engine documentation.
Please note, if you are using additional modifiers as Zend View Helpers use camel case functions naming. For example instead of {$this->zend_debug($var)} you should use {$this->zendDebug($var)}
When use Zend View helper, you should write: {$this->helper()} instead of <?php echo $this->helper()?>
Variable modifiers
You can use common Smarty variable modifies, additional varible modifies provided by Notando engine and some php functions allowed to use as smarty modifies either. All additional modifiers are also available as Zend View Helpers. For example {'Text to translate'|lang} and {$this->lang('Text to translate')} are both correct.
To provide webshop engine security not all php functions are avaiable as modifers. You are able to use the following:
count, strpos, strropos, intval, floatval,
json_encode, json_decode, implode, explode, trim, html_entity_decode, htmlentities,
htmlspecialchars_decode, htmlspecialchars, join, lcfirst, ltrim, nl2br, strip_tags,
addslashes, stripcslashes, strlen, strtolower, strtoupper, ucfirst, ucwords,
date_format, date, strtotime, jsonEncode, jsonDecode
.
Please note, this functions are not accessable as Zend View Helpers.
Additional variable modifiers list
| Modifier | Description |
| productLink |
This is used to create product link.
Parameters:
Example:
<a href="{$product|productLink:$category_id}">{$product->name}</a>
Zend View Helper syntax example:
<a href="{$this->productLink($product, $category_id)}">{$product->name}</a>
|
| lang |
This is used to get translated version of a string.
If additional parameters exists they will be passed as arguments for
sprintf() php function.
Example: part of .po file:
msgid "String to translate"
template:
msgstr "Translated string" msgid "%s, you have %d items in your cart." msgstr "%s, you have %d items in your cart."
{'String to translate'|lang}
will output:
{'%s, you have %d items in your cart.'|lang:'User':3}
Translated string
User, you have 3 items in your cart. Zend View Helper syntax example:
{$this->lang('String to translate')}
{$this->lang('%s, you have %d items in your cart.', 'User', 3)} |
| numberFormat |
This formats a number into the given number format.
Parameters:
Example:
{10.5|numberFormat:'webshop_amount'}
will output, if webshop_amount set to 2 digits after dot:
10,50
Zend View Helper syntax example:
{$this->numberFormat(10.5)}
|
| zend_debug |
This will output dump of a variable with
Zend_Debug::dump().
Example:
<?php
//Controller code $this->view->test_array = array(1, 2, 3); ?> {*Template code*} {$test_array|zend_debug} Zend View Helper syntax example:
{$this->zendDebug($test_array)}
|
Template specific modifiers
When including resources or template files you must use theme modifiers, for example:
{include file='controllers/login/index.phtml'|theme_template}
Custom functions
All custom functions are also available as Zend View Helpers.
