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 create a new page in nTeN script? It's very simple! Just look bellow ;)


1) Create GET handler file:

Create file mypage.php in directory /zx-content/themes/default/handlers/get/. Open file and enter code which you see bellow.

<?php

// check if file is called by script or directly from browser if so end script
if(!defined('_nTeN')){
    exit;
}

// write your code


// assign variables to template file
$Smarty->assign('var', 'data');

// assign page title
$Smarty->assign('CORE', array(
    'HEAD' => array(
        'TITLE' => 'Page title'
    )
));

// render template file
$Smarty->display(preg_replace('/\.php$/', '', basename(__FILE__)).'.tpl');

?>
2) Create POST handler file:

Create file mypage.php in directory /zx-content/themes/default/handlers/post/. Open file and enter code which you see bellow. It's is not necessary if you will not use the POST method in your code.

<?php

// check if the file is open by script or directly from browser, if so, end script execution
if(!defined('_nTeN')){
    exit;
}

// write your code


?>
3) Create template file:

Create file mypage.tpl in directory /zx-content/themes/default/templates/. Open file and enter code which you see bellow. It's is not necessary if you will not use Smarty as template engine.

{* include to this template head file *}
{include file='theme.head.tpl'}

<div>
    This is mypage!
</div>

{* include to this template footer file *}
{include file='theme.footer.tpl'}
Just a three simple steps to create a new page in the nTeN script.

To open new created page just open this URL address http://yourdomain.com/?x=mypage ( of course, do not forget to change the domain name ;) ). If you want create other page, create files with the same way but change files name to other eq. get/otherpage.php, post/otherpage.php and otherpage.tpl.