|
|
|
Here is an html template:
| <html>
<body>
<h1>Alternating list example with: <a href ="http://www.templatetamer.com/">
TemplateTamer</a></h1>
<table width=256>
<!--NAME:ONEITEM -->
<!--NAME:WHITEROW -->
<tr bgcolor="white">
This is an white item number: {ITEMNUMBER}
</tr>
<!--END:WHITEROW -->
<!--NAME:BLUEROW -->
<tr bgcolor="cyan">
This is an blue item number: {ITEMNUMBER}
</tr>
<!--END:BLUEROW -->
<!--END:ONEITEM -->
</table>
</body>
</html> | |
Here is the logic code for the page:
| <?PHP
// Logic code for the TemplateTamer page: REPEATED_TEMPLATE
class alternating_list_Page extends TemplateTamer_Page {
function alternatingRows($n=10) {
//this creates an array with elements for each item to be displayed
//but this time we once include BLUEROW template, and next time WHITEROW,
//and the again BLUEROW, ...
for ($i=0;$i<$n;$i++) {
if ($itemKey == 'BLUEROW')
$itemKey = 'WHITEROW';
else
$itemKey = 'BLUEROW';
$itemList[] = array( $itemKey => array( ITEMNUMBER => $i ) );
}
return $itemList;
}
function getData() {
return array(
'ONEITEM' => new RepeatTemplate( $this -> alternatingRows() )
);
}
}
?> | |
http://www.templatetamer.org/ |
|
| PHP template processing Categories : PHP, Templates, HTML and PHP | | | GoTemplate Categories : PHP, Complete Programs, Templates | | | Cache parsed templates of ETS - Easy Template System with Turck-MMCache Categories : PHP, Templates | | | Parsing Simple Template Files and Data Categories : PHP, PHP Classes, Templates, Regexps | | | Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP, PHP, HTML, PDF, Excel | | | Expose - PHP template engine, supports server and client-sided caching,a plugin system, multiple languages, template script language is based on PHP itself. Categories : PHP, PHP Classes, Templates, Complete Programs | | | Simple Template Class/Example Categories : PHP, Templates, PHP Classes | | | Very minimal templating engine Categories : PHP, PHP Classes, Templates | | | Website Engine Categories : PHP, HTML and PHP, Templates | | | Retrieve text from table and email to your e-
address in pipe delimited format. Categories : PHP, MySQL | | | Accepts a database & hostname from a user and then HTTP username and password. Uses this to connect to a MySQL database. Produces a form based on the tables it finds there to allow the user to do SELECTs, INSERTs, and DELETEs. Categories : Databases, PHP, MySQL, Complete Programs | | | PHP Script to find url links in a page Categories : PHP, URLs, Regexps, Arrays | | | Using $PHP_AUTH_USER and $PHP_AUTH_PW to authenticate. Categories : Authentication, PHP | | | very simple ftp class Categories : PHP, PHP Classes, FTP | | | PHP Paypal IPN Integration Class v1.0.0 Categories : PHP, PHP Classes, Payment Gateways | |
|
|
|