<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Sigma example 3: building template from multiple files</title> </head> <body> <h1>Σ<sub>template</sub> example 3: building template from multiple files</h1> <p>Please note that block names should be unique within the template even if the template is built from multiple files. Therefore it is usually a <b>bad</b> idea to include one file in two different places, unless this file contains no blocks.</p> <h2>1. Using <!-- INCLUDE filename --> within template</h2> <p>This is the way to include a file from within a template, no additional code is required in your script. Note that this creates no blocks except ones already present in main and included files.</p> <!-- INCLUDE example_3_include.html --> <h2>2. Using addBlockfile()</h2> <p><b>addBlockfile()</b> creates a new block in place of a variable placeholder.</p> {addblockfile} <h2>3. Using replaceBlockfile()</h2> <p><b>replaceBlockfile()</b> replaces the existing block with a new content.</p> <h3>3.1 Keeping the previously parsed contents</h3> <p>You can keep the parsed contents of the original block and continue iteration over the new one.</p> <ul> <!-- BEGIN replace_block_1 --> <li>Original block: {item_title}</li> <!-- END replace_block_1 --> </ul> <h3>3.2 Discarding the previously parsed contents</h3> <p>Or you can discard the parsed contents and start from scratch (this is the default behaviour).</p> <!-- BEGIN replace_block_2 --> <ul> <!-- BEGIN replace_block_2_item --> <li>{item_title}</li> <!-- END replace_block_2_item --> </ul> <!-- END replace_block_2 --> </body> </html>