函数

    每个Smarty标记要么打印一个变量要么调用所谓函数。函数的调用和显示是通过将函数和它的属性包含在分隔符中实现的,形如:{funcname attr1='val1' attr2='val2'}

例子3-3. 函数语法

{config_load file='colors.conf'}

{include file='header.tpl'}
{insert file='banner_ads.tpl' title='Smarty is cool'}

{if $logged_in}
    Welcome, <font color="{#fontColor#}">{$name}!</font>
{else}
    hi, {$name}
{/if}

{include file='footer.tpl' ad=$random_id}

    参见register_function()