Wiki

Solution: Dealing with templates with static strings or ids

Description

You should not leave static strings or ids within a customized template where ever possible.

Instead you should move these into a settings file and make reference to the custom settings variables you define.

Example

This example should show clearly a basic example of how to store your custom variable contents within a settings file and access them in a template.

Setting

File: settings/override/example_com.ini.append.php

<?php /* #?ini charset="utf-8"?
 
[CustomNodeIDs]
NodeName001=42
NodeName002=84
NodeName003=11
 
*/ ?>

Template

File: design/standard/templates/pagelayout.tpl

{def $node_name_001 = ezini( 'CustomNodeIDs', 'NodeName001', 'example_com.ini' )}
{if is_set( $node_name_001 )}
    [...display something...]
{else}
   [...display something else...]
{/if}

Reference