一、模板 调用
比如在某个模板中,想调用另一个模板中的内容,可以用下面的语句:
{template xxx}
假设,建立了一个新模板名字叫 "abc.htm" ,在后台 模板编辑时只会显示为 "acb",需要在 index 中调用它,那么就在index 中适当位置加入 {template abc}
那么就会自动代用它。
相关实例: index 模板中,最顶有 {template header},最底有 {template footer}
相关疑问:
那么在这个 abc 模板中需要有
<!--{if $discuz_uid}--> --- 如果获取了 $discuz_uid ,即显示下面资料(判断1)<br> <span class="bold">$discuz_userss: </span> <a href="$link_logout">{lang<span class="t_tag">logo</span> ut}</a> <br><br> <!--{if $maxpmnum}--> --- 如果有 $maxpmnum,即显示下面资料,否则不显示(判断2)<br> | <a href="pm.php" target="_blank">{lang pm}</a> <br> <!--{/if}--> --- 结束了这个判断(判断2) <br><br> | <a href="memcp.php">{lang memcp}</a> <br><br> <!--{if in_array($adminid, array(1,2,3))}--> --- 如果$adminid在1,2,3这三个范围内,即显示下面资料,否则不显示(判断3)<br> | <a href="admincp.php" target="_blank">{lang admincp}</a><br> <!--{/if}--> --- 结束了这个判断(判断3) <br><br><!--{else}--> --- 如果获取不了 $discuz_uid ,则显示下面资料 <br><br> <span class="bold">{lang guest}: </span><a href="$link_register">{lang register}</a><br> | <a href="$link_login">{lang login}</a> <br><br><!--{/if}--> --- 结束这个判断(判断1)
2. The statements xxx are often seen in templates.
This is a loop statement, which will automatically end until the data is output.
Through these syntaxes, the same series of data can be displayed in a loop.
Related examples:
in header template
<!--{loop $plugins['links'] $plugin}--> --- Start loop 1, determine the plug-in <code id="code1"><!--{loop $plugins['links'] $plugin}--> --- 循环1开始,判断插件<br> <!--{loop $plugin $module}--> --- 循环2开始,判断插件模组 <br> <!--{if !$module['adminid'] || ($module['adminid'] && $adminid > 0 && $module['adminid'] >= $adminid)}-->| $module[url] <!--{/if}--> <br> <!--{/loop}--> --- 结束循环2 <br><!--{/loop}--> --- 结束循环1
--- Loop 2 starts, determine the plug-in module
< ;!--{/loop}--> --- End loop 2 --- End loop 1
4. Language call
In templates, you often see statements like {lang xxx}. It is used to call words in the language package. Most of the things that will be called in templates are templates.lang.php.
<? -- 宣布php语言开始<BR>$language = array<BR>( --- 以上宣布语言包定义开始 <br><br> 'title' => '标题', <br> 调用字符 显示文字 <br> 'never' => '从未', <br> 调用字符 显示文字<br> ....<br>); --- 宣告语言包定义结束<br>?> -- 宣布php语言结束
& lt ;?-Announce the beginning of PHP language <p> $ Language = Array <span style="COLOR: blue"> title' => 'Title', </span> -- Announce the end of the language package definition <br>?> -- Announce the end of the php language </p>
After what has been said above, you should know a lot about what you need to pay attention to or what can be applied when modifying templates!
TechArticle