Template sections
Template section is the 'loop' or 'if' flow control structure in template. It is in form of xml tags and has only one attribute 'name', which is mandatory. Template section is controlled by a section info object in the PHP source.
* Example of template section
<mi:section name="ProductOptions">
%%OPTIONNAME%% : %%OPTIONVALUE%%<br />
</mi:section>
<?php
// First parameter is the name of template section. It links with the name attribute from the template
// Second parameter is the number of iterations - for simulating 'if' this is set to appropriate number (0 or 1) depending of the evaluated condition
// For looping this is set to the array size
// Third parameter is the actual array to be looped
$options = array(
'%%OPTIONNAME%%' => array('Color', 'Size'),
'%%OPTIONVALUE%%' => array('Black', '80x20x40')
);
$section = new miTemplateParserSectionInfo('ProductOptions', 2, $options);
$form->addTemplateSectionInfo($section);
?>
After parsing the form result will be:
Color : Black
Size: 80x20x40