Login   Register  
PHP Classes
elePHPant
Icontem

File: ex1.xtpl

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of barnabás debreceni  >  XTemplate  >  ex1.xtpl  >  Download  
File: ex1.xtpl
Role: ???
Content type: text/plain
Description: template file for ex1.p
Class: XTemplate
Template engine for PHP
Author: By
Last change:
Date: 2000-06-09 11:58
Size: 1,136 bytes
 

Contents

Class file image Download
<!-- BEGIN: main -->
<html>
<head><title>example 1</title></head>
<body>
this is a simple replace test. the text in bold should contain "TEST": <b>{VARIABLE}</b><br>
now a dynamic block test:<br>
	
	<!-- BEGIN: block1 -->
	this is block 1.<br>
	<!-- END: block1 -->
	
	<!-- BEGIN: block2 -->
	this is block 2.<br>
	<!-- END: block2 -->

	<!-- BEGIN: block3 -->
	<p><table border=1>
		<tr>
			<td>id</td>
			<td>{DATA.ID}</td>
		</tr>
		<tr>
			<td>name</td>
			<td>{DATA.NAME}</td>
		</tr>
		<tr>
			<td>age</td>
			<td>{DATA.AGE}</td>
		</tr>
	</table></p>
	<!-- END: block3 -->

<br><br>
global variables can be parsed directly into the html without assigns:<br>
$HTTP_HOST={PHP.HTTP_HOST}<br>
$PHP_SELF={PHP.PHP_SELF}<br>
$HTTP_USER_AGENT={PHP.HTTP_USER_AGENT}<br>
etc..<br>
(<font color=red>note</font> that these variables are scanned in the constructor when creating the XTemplate object!
so if you need some variables which you have set after creating the template object, you need to call <b>$xtpl->scan_globals()</b>
before parsing the actual block!
</body>
</html>
<!-- END: main -->