LoginLogin  Blog About
Search:

Support » Knowledge Base » Shop-Script » Design setup »

Use of PHP code in design templates

For generation of the HTML code of the WebAsyst Shop-Script storefront the Smarty templates engine is used. Smarty processes special template files containing a mixture of HTML and special Smarty code to output the resulting HTML content which is returned to the browser.

Tip: storefront design template files are located in the /published/SC/html/scripts/templates/frontend directory.

To add PHP code to a Smarty template file, tags {php} ... {/php} are used, e.g.:

{php}
echo 'Hello world!';
{/php}

Note that in WebAsyst Shop-Script support of the {php} ... {/php} tags is disabled by default. To enable it, edit file /published/SC/html/scripts/classes/class.view.php to change line

$this->security_settings['PHP_TAGS'] = false;

as follows:

$this->security_settings['PHP_TAGS'] = true;

In addition to template files, PHP code can also be added in the same manner by means of the built-in design editor only in the "Advanced mode (HTML)".