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 for the {php} ... {/php} tags is disabled by default. To enable it, edit file /published/SC/html/scripts/classes/class.viewsc.php to change line

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

as follows:

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

Note: If the above-mentioned file is not available in your version of WebAsyst Shop-Script, apply the same changes to file /published/SC/html/scripts/classes/class.view.php.

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)".

Note: Use of PHP code as described in this article in the descriptions of products and categories, and in info pages is not possible, because such texts are stored in the database and are not processed by the Smarty template engine.