Creating simple page

In TF context "simple pages" are pages that have simple behaviour much like static HTML pages, i.e. they don't accept GET / POST parameters (strictly speaking - they don't care about them).

Let's say that you want to create page called my_page. You will have to create following files:

  1. /htdocs/my_page.php

    To get content for the interceptor file open /hidden/src_templates/page_template.php and copy the content in your newly created /htdocs/my_page.php. Change it so it looks like:

    <?php

    require_once('boot.inc.php');
    boot('my_site');


    require_once(
    $WSC->get_site_inc_dir().'pages/my_page_wp.class.php');

    session_start();

    $page = new My_Page_WP('my_page');
    $SITE->run($page, new Web_Context);

    Important thing here is the row $page = new My_Page_WP('my_page');. The string 'my_page' is the page name. It must be alphanumeric, starting with letter, underscore allowed, 100 characters max. Page name corresponds to filename of the page's tpl file, i.e. in this case TPL file must be called my_page.tpl. If, for example, page name is 'my_other_page', TPL file must be my_other_page.tpl. Page TPL files reside in hidden/tpl/pages.

  2. /hidden/inc/pages/my_page_wp.php

    Open /hidden/src_templates/page_template_wp.class.php ant copy its content into /hidden/inc/pages/my_page_wp.php. Change it so it looks like (just change the class name):

    <?php
    // $Id$
    require_once($WSC->get_site_inc_dir().'site_web_page.class.php');

    class 
    My_Page_WP extends Site_Web_Page {
        public function 
    init() {
            
    parent::init();

            
    $v = new Site_Web_Page_View($this);
            
    $this->add_view($v);
        }

        public function 
    run() {


            
    $view $this->get_view('default');


            return 
    $view;
        }
    }

  3. /hidden/tpl/pages/my_page.tpl

    Open /hidden/tpl/pages/my_page.tpl and put some content in it. For example

    
    <strong>My page!</strong>
                        
                        

Open the page in your browser and you should see My page!

Note: Please note that this is the simplest approach (i.e. using just one TPL file like my_page.tpl) which does not provide multilingual support. Further in the section called “Page view's TPL files "classic" structure” you will see how to create TPLs that provide multilingual support.