Cookies on the Xeoncoder.com

We use cookies to ensure that we give you the best experience on our website.
The cookies cannot identify you. If you continue without changing your settings
we'll assume that you are happy to receive all cookies on the Xeoncoder.com website.

How to work with the php functions in nTeN script... a few examples.


Currency function:

The {currency} function is used to easily display money amount depending on the selected currency in Control Panel.

// function without settings
{currency amount=1000.50}
// function raw output
<span title="Dollars: United States of America">$1000.5 USD</span>
// function output
$1000.5 USD

// function with format settings
{currency amount=1000.50 format=[2,'.',',']}
// function raw output
<span title="Dollars: United States of America">$1,000.50 USD</span>
// function output
$1,000.50 USD

// function with tag settings
{currency amount=1000.50 tag=['<b>', '</b>']}
// function raw output
<span title="Dollars: United States of America">$<b>1000.5</b> USD</span>
// function output
$1000.5 USD

// currency function with all settings
{currency amount=1000.50 format=[2,'.',','] tag=['<b>', '</b>']}
// function raw output
<span title="Dollars: United States of America">$<b>1,000.50</b> USD</span>
// function output
$1,000.50 USD
Banner rotator function:

The {banner} function can be used in any .tpl file in directory /zx-content/themes/default/templates/. Place function code where you want to display the banners. Example is in theme.head.tpl or theme.footer.tpl. By this way banners will be visible at each page of the script.

/*
    The banner sizes available in nTeN PTC script:
    - 125x125 - Square Button (125 x 125 pixel)
    - 180x150 - Rectangle (180 x 150 pixel)
    - 234x60  - Half Banner (234 x 60 pixel)
    - 468x60  - Full Banner (468 x 60 pixel)
    - 728x90  - Leaderboard (728 x 90 pixel)
    - 300x250 - Medium Rectangle (300 x 250 pixel)
    - 336x280 - Large Rectangle (336 x 280 pixel)
    - 120x600 - Skyscraper (120 x 600 pixel)
    - 160x600 - Wide Skyscraper (160 x 600 pixel)
*/

// render banner rotator with size 468x60
{banner sizes=['468x60']}

// render banner rotator with size 468x60 and 728x90
{banner sizes=['468x60','728x90']}
Link function:

The {link} function can be used in any .tpl file in directory /zx-content/themes/default/templates/. The {link} function is used to generate link URL's which depends on config variables ZX_SWITCH_VAR and ZX_SWITCH_ACCOUNT_VAR.

// generate link to account page
{link area="account"}
// function output
/?x=account&a=profile

// generate link to profile page
{link area="account" section="profile"}
// function output
/?x=account&a=profile

// generate link to profile page with query
{link area="account" section="profile" query="&name=variable"}
// function output
/?x=account&a=profile&name=variable
Own function:

Using own php functions in templates is very easy! Functions file is available in directory /zx-content/themes/default/handlers/functions.php. Place your functions code in this file and call them from any template or handler file.

// example of function from file functions.php
function forTests($text){
    return $text;
}

// call function
{forTests("This is my variable!")}
// function output
This is my variable!
// assign function to variable
{assign var=myVar value=forTests("This is my variable!")}
// dump of myVar variable
string(20) "This is my variable!"