smarty : assign var and scope root <p>I have a template in smarty like this :</p> <ul> <li>Template folder <ul> <li>home.tpl</li> <li>article.tpl</li> <li>category.tpl</li> <li>var.tpl</li> </ul></li> </ul> <p>In each template file (except var.tpl), i include the file var.tpl. home.tpl have a structure in 1 column article.tpl have a structure in 2 columns</p> <p>My template files are like this (home example) :</p> <pre><code>{include file="$tpl_dir./var.tpl"} &lt;div class="span{$center_column}" id="center_column"&gt; &lt;/div&gt; </code></pre> <p>In order to change quickly the apparence of my website, i wrote the following lines in var.tpl :</p> <pre><code>{assign var=center_column_g value=['home'=&gt;'12','article'=&gt;'10'] scope="root"} {assign var=center_column_default value='10' scope="root"} {if $center_column_g[$page_name]} {assign var=center_column value=$center_column_g[$page_name] scope="root"} {else} {assign var=center_column value=$center_column_default scope="root"} {/if} </code></pre> <p>ps : $page_name is a global variable with the name of each template page.</p> <p>So with var.tpl, if i can easy change the class of my div #center_column</p> <p>I have a doubt with this code :</p> <pre><code>{if $center_column_g[$page_name]} {assign var=center_column value=$center_column_g[$page_name] scope="root"} {else} {assign var=center_column value=$center_column_default scope="root"} {/if} </code></pre> <p>Is it right to assign var center_column in the root scope ?</p>