首页 > 代码库 > OneThink-nav标签

OneThink-nav标签

/* 导航列表 */    public function _nav($tag, $content){        trace($tag);        trace($content);        trace("end");        $field  = empty($tag[‘field‘]) ? ‘true‘ : $tag[‘field‘];        $tree   =   empty($tag[‘tree‘])? false : true;        $parse  = $parse   = ‘<?php ‘;        $parse .= ‘$__NAV__ = M(\‘Channel\‘)->field(‘.$field.‘)->where("status=1")->order("sort")->select();‘;        if($tree){            $parse .= ‘$__NAV__ = list_to_tree($__NAV__, "id", "pid", "_");‘;        }        $parse .= ‘?><volist name="__NAV__" id="‘. $tag[‘name‘] .‘">‘;        $parse .= $content;        $parse .= ‘</volist>‘;        // trace($parse);        return $parse;    }

   使用自定义标签

<think:nav name="nav">                    	<eq name="nav.pid" value="http://www.mamicode.com/0">                        <li>                            <a href="http://www.mamicode.com/{$nav.url|get_nav_url}" target="<eq name=‘nav.target‘ value=http://www.mamicode.com/‘1‘>_blank_self">{$nav.title}</a>                        </li>                        </eq>                    </think:nav>

  

OneThink-nav标签