Source for file sample_itx_addblockfile.php
Documentation is available at sample_itx_addblockfile.php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
* An example for the usage of ITX::addBlockfile
* @version CVS: $Id: sample_itx_addblockfile.php 216180 2006-07-11 21:56:05Z dsp $
require_once 'HTML/Template/ITX.php';
$data = array (array ('packagename'=> 'mypackage',
'changelog' => array ('fix bug #002',
'add author FOO to AUTHORS')
array ('packagename'=> 'mypackage',
'changelog' => array ('fix bug #002',
$tpl->loadTemplatefile ('addblockfile_main.tpl.htm', true , true );
// The complete content of "addblockfile_main.tpl.htm" will be loaded into a block
// called "list_template". The placeholder {DESCRIPTION} will be replaced
// with the added block "list_template".
$tpl->addBlockfile ('DESCRIPTION', 'list_template', 'addblockfile_list.tpl.htm');
// we now have the following blocks loaded:
// __global__, row, list_template and listelement
foreach ($data as $entry) {
// assign data to the inner block (listelement) of list_template.
$tpl->setCurrentBlock ('listelement');
foreach ($entry['changelog'] as $changelogentry) {
$tpl->setVariable ('ENTRY', $changelogentry);
$tpl->parseCurrentBlock ();
// assign data to the added list_template block
$tpl->setCurrentBlock ('list_template');
$tpl->setVariable ('LISTNAME', $entry['version']);
$tpl->parseCurrentBlock ();
// back in the original templatefile we assign data to the row block
// {DESCRIPTION} is not longer available, because it was replaced by the
$tpl->setCurrentBlock ('row');
$tpl->setVariable ('NAME', $entry['packagename']);
$tpl->parseCurrentBlock ();
Documentation generated on Mon, 11 Mar 2019 15:36:53 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|