tpl文件中“{#...#}”标记的含义是什么?

时间:2013-09-16 07:47:41

标签: html css tags

以下代码中所有{#...#}标记的含义是什么?

 {include file="header.tpl" title="install" showheader="no"}

<div class="install" style="text-align:center;padding:5% 0 0 0;">
    <div style="text-align:left;width:500px;margin:0 auto;padding:25px 25px 15px 25px;background:white;border:1px solid;">

        <h1>{#installcollabtive#}</h1>

        <div style="padding:16px 0 16px 0;">
            <h2>{#installstep#} 3</h2>
            <em>{#createadmin#}</em><br /><br />

            <form class = "main" name = "adminuser" method = "post" enctype="multipart/form-data" action = "install.php?action=step3">
                <fieldset>
                    <div class = "row"><label for = "username">{#name#}:</label><input type = "text" name = "name" id = "username" /></div>
                    <div class = "row"><label for = "pass">{#password#}:</label><input type = "password" name = "pass" id = "pass" /></div>
                </fieldset>
                <br />
                    <div class="row-butn-bottom">
                        <label>&nbsp;</label>
                        <button type="submit"  onfocus="this.blur();">{#continue#}</button>
                    </div>
                </fieldset>
            </form>

                </div>
            </div>
        </div> {*Install end*}
    </body>
</html>

非常感谢任何帮助,非常感谢!

1 个答案:

答案 0 :(得分:1)

从配置文件加载的变量通过将它们封装在#hash marks#中或使用smarty变量$smarty.config来引用。后面的语法对于嵌入引用的属性值非常有用。

示例配置文件:

pageTitle = "This is mine"
bodyBgColor = '#eeeeee'
tableBorderSize = 3
tableBgColor = "#bbbbbb"
rowBgColor = "#cccccc"

演示#hash#方法的模板:

{config_load file='foo.conf'}
<html>
<title>{#pageTitle#}</title>
<body bgcolor="{#bodyBgColor#}">
<table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}">
<tr bgcolor="{#rowBgColor#}">
    <td>First</td>
    <td>Last</td>
    <td>Address</td>
</tr>
</table>
</body>
</html>

演示$smarty.config方法的模板:

{config_load file='foo.conf'}
<html>
<title>{$smarty.config.pageTitle}</title>
<body bgcolor="{$smarty.config.bodyBgColor}">
<table border="{$smarty.config.tableBorderSize}" bgcolor="{$smarty.config.tableBgColor}">
<tr bgcolor="{$smarty.config.rowBgColor}">
    <td>First</td>
    <td>Last</td>
    <td>Address</td>
</tr>
</table>
</body>
</html>