Notice: Undefined offset: 8192 in /home/miphpf/domains/miphpf.com/public_html/includes/common.inc on line 499

Notice: Undefined offset: 8192 in /home/miphpf/domains/miphpf.com/public_html/includes/common.inc on line 506

Warning: Incorrect key file for table './miphpf_miphpfcom/watchdog.MYI'; try to repair it query: INSERT INTO watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', 'preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/miphpf/domains/miphpf.com/public_html/includes/unicode.inc on line 291.', 2, '', 'http://www.miphpf.com/manual/template_sections.html', '', '44.200.122.214', 1728744912) in /home/miphpf/domains/miphpf.com/public_html/includes/database.mysql.inc on line 121
Template sections | MIPHPF - Your Open Source RAD PHP Framework
Skip navigation.
Home

Template sections

: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/miphpf/domains/miphpf.com/public_html/includes/unicode.inc on line 291.

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