Login   Register  
PHP Classes
elePHPant
Icontem

File: atemplate_test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Ergin SOYSAL  >  ATemplate  >  atemplate_test.php  >  Download  
File: atemplate_test.php
Role: ???
Content type: text/plain
Description: Sample usage for ATemplate
Class: ATemplate
Another html template implementation
Author: By
Last change:
Date: 13 years ago
Size: 2,117 bytes
 

Contents

Class file image Download
<?
  include ('atemplate.inc.php');


// first, load the template files will be used
  $tpl = new atemplate(
             array (
                 MAIN => 'tpl/main.tpl',
                 TOP => 'tpl/top.tpl',
                 MENU => 'tpl/menu.tpl',
                 SUBMENU => 'tpl/submenu.tpl',
                 RIGHT=> 'tpl/right.tpl'
                 )
              );


// Top of our page it's formed by using top.tpl
// notice! no variables defined here. Put bare html as is.
  $tpl->process(TOP, array());

// right site, using right.tpl
// set the single variable named RIGHTSIDE
// as "..".
  $tpl->process(RIGHT, array(
             RIGHTTITLE => 'New!',
             RIGHTTEXT => 'This is right site<br> This place may be
              useful for news, link suggestions etc.'
             )
          );

// Left site. Well, crete a number of menus here using
// menu.tpl and submenu.tpl, then will be embedded into
// main.tpl (e.i. MAIN)
  $tpl->process(MENU, array(
         HREF => 'test.php?id=1',
         MENULINK => 'Test Menu1' ));

  //
  $tpl->process(SUBMENU, array(
         HREF => 'test.php?id=3',
         MENULINK => 'Test Sub Menu 1.1' ));

  $tpl->process(SUBMENU, array(
         HREF => 'test.php?id=1',
         MENULINK => 'Test sub Menu 1.2' ));

  $tpl->append(SUBMENU, MENU);

  $tpl->process(MENU, array(
         HREF => 'test.php?id=2',
         MENULINK => 'Test Menu2' ));

  $tpl->process(SUBMENU, array(
         HREF => 'test.php?id=6',
         MENULINK => 'Test Sub Menu 2.1' ));

  $tpl->process(SUBMENU, array(
         HREF => 'test.php?id=7',
         MENULINK => 'Test sub Menu 2.2' ));

  $tpl->append(SUBMENU, MENU);

// Main is the general layout
// it will be formed by pieces

  $tpl->process(MAIN, array(
    CONTENT => "A long text file to generate the <i>content</i>,
     <b>dinamically</b>"));

// you must be completed processing individual templetes before
//  embed them
  $tpl->embed(MENU, MAIN);
  $tpl->embed(TOP, MAIN);
  $tpl->embed(RIGHT, MAIN);

  $tpl->printit();
?>