..........可能是我还没看到那吧,不过手册里的built-in Functions 好像叫内建函数Chapter 7. Built-in Functions[第七章.内建函数] Table of Contents capture config_load foreach,foreachelse include include_php insert if,elseif,else ldelim,rdelim literal php section,sectionelse strip Smarty comes with several built-in functions. Built-in functions are integral to the template language. You cannot create custom functions with the same names, nor can you modify built-in functions.Smarty自带一些内建函数. 内建函数是模板语言的一部分. 用户不能创建名称和内建函数一样的自定义函数,也不能修改内建函数. 原本明白点了,现在又糊涂了~~~~呵呵
而且include的assign属性时,模板内容赋给了变量同时也输出的页面了的
如果需要capture的部分不多,或者有嵌套,include会比较麻烦吧
include是将一个文件的内容赋给变量你不用capture,只用include是可以完全实现capture的功能的。但有时用capture可读性要好很多。
比如<capture ...>abcde</capture>可以直接把abcde赋给capture。如果你用include的话那还得另开一个文件。对方要看到内容还得打开那个文件。
很多词都是大家随便翻译一下慢慢用成了习惯的。你也不想我满嘴中英文混合吧。smarty的确很多功能是重复的。它主要从应用角度出发,一切为了代码更简洁。你不需要觉得这里面有什么问题。
只是想了解一下一般写smarty的模式,怎样的模式比较简洁易懂。里面没有函数的概念,写不了function(),但是提供了许多诸如capture,include,include_php,insert能让php与smarty互相调用的接口,所以想知道大家平时都是怎么用的,或者一般情况下大家都会怎么应用他们,怎么配合起来才能只调用一个tpl,传给该tpl几个参数,就可以实现某一种功能,而不需要为了这种功能而不断的重复编码,不知道我说的明白没有~~~~~~纯属讨论,我会继续学习,没有很大疑惑,再听听大家的经验我就结贴了~~~
Table of Contents
capture
config_load
foreach,foreachelse
include
include_php
insert
if,elseif,else
ldelim,rdelim
literal
php
section,sectionelse
strip
Smarty comes with several built-in functions. Built-in functions are integral to the template language. You cannot create custom functions with the same names, nor can you modify built-in functions.Smarty自带一些内建函数.
内建函数是模板语言的一部分.
用户不能创建名称和内建函数一样的自定义函数,也不能修改内建函数.
原本明白点了,现在又糊涂了~~~~呵呵