码迷,mamicode.com
首页 > Web开发 > 详细

thinkphp-路由功能

时间:2017-04-18 20:50:34      阅读:284      评论:0      收藏:0      [点我收藏+]

标签:输出   image   return   pre   line   black   library   css   prot   

        导入扩展标签

<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>  //自定义的标签

 

 

//输出 红字边框

 

thinkphp-路由功能

标签:输出   image   return   pre   line   black   library   css   prot   

原文地址:http://www.cnblogs.com/yjh1604600160/p/think11.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!