Simple example
This post refers to DotKernel 1, based on Zend Framework 1.
If you are looking for DotKernel 3 related posts, go here.
If you are looking for DotKernel 3 related posts, go here.
Template file: authors.tpl
{PAGE_TITLE}
Name | |
---|---|
{NUM_AUTHORS} | |
{AUTHOR_NAME} | {AUTHOR_EMAIL} |
PHP code: authors.php
'author1@php.net',
'Author 2' => 'author2@yahoo.com'
);
//load file
$tpl->setFile('tpl_authors', 'authors.tpl');
//set block
$tpl->setBlock('tpl_authors', 'authorline', 'authorline_block');
//set some variables
$tpl->setVar('NUM_AUTHORS', count($authors));
$tpl->setVar('PAGE_TITLE', 'Code authors as of ' . date('Y-m-d'));
//display the authors
foreach ($authors as $name => $email) {
$tpl->setVar('AUTHOR_NAME', $name);
$tpl->setVar('AUTHOR_EMAIL', $email);
$tpl->parse('authorline_block', 'authorline', true);
}
// parse and print the output
$tpl->pparse('OUTPUT', 'tpl_authors');
?>
Leave a Reply