PHP Classes

File: ex1.p

Recommend this page to a friend!
  Classes of barnabás debreceni   XTemplate   ex1.p   Download  
File: ex1.p
Role: ???
Content type: text/plain
Description: example 1 (demonstrates basic features)
Class: XTemplate
Template engine for PHP
Author: By
Last change:
Date: 23 years ago
Size: 837 bytes
 

Contents

Class file image Download
<? /* example 1 demonstrates basic template functions -simple replaces ( {VARIABLE1}, and {DATA.ID} {DATA.NAME} {DATA.AGE} ) -dynamic blocks */ require "xtpl.p"; $xtpl=new XTemplate ("ex1.xtpl"); $xtpl->assign("VARIABLE","TEST"); /* simple replace */ $xtpl->parse("main.block1"); /* parse block1 */ //$xtpl->parse("main.block2"); /* uncomment to parse block2 */ /* you can reference to array keys in the template file the following way: {DATA.ID} or {DATA.NAME} say we have an array from a mysql query with the following fields: ID, NAME, AGE */ $row=array( ID=>"38", NAME=>"cranx", AGE=>"20" ); $xtpl->assign("DATA",$row); $xtpl->parse("main.block3"); /* parse block3 */ $xtpl->parse("main"); $xtpl->out("main"); ?>