导入扩展标签
<taglib name="html" />
接下来
<html:imageBtn value="按钮" /> //按钮
<html:editor id="editor" name="remark" type="FCKeditor" style="" >{$vo.remark}</html:editor> //文本框
可再配置文件里输入
‘TAGLIB_BUILD_IN‘=>‘cx,html‘,
//就可使其内置标签 //<imageBtn value="按钮" />
‘TAGLIB_PRE_LOAD‘=>‘html‘,
//有它就可以不用导入扩展标签
自定义标签库
ThinkPHP/Library/Think/Template/TagLib下创建
//Test.class.php
class Test extends TagLib{
protected $tags=array(
‘mytest‘=>array(‘attr‘=>‘color,border‘,‘close‘=>1),
); //两个属性 1为闭合标签,0为单标签
public function _mytest($tag,$content){
$color=‘‘;
$border=‘‘;
if(isset($tag[‘color‘])){
$color=‘color:‘.$tag[‘color‘].‘;‘;
}
if(isset($tag[‘border‘])){
$border=‘border:‘.$tag[‘border‘].‘px solid black;‘;
}
$css=$color.$border;
return ‘<div style="‘.$css.‘">‘.$content.‘</div>‘;
}
}
<taglib name="test" /> //导入
<test:mytest color="red" border="2">160</test:mytest> //自定义的标签
//输出 红字边框