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="0">
                        <li>
                            <a href="{$nav.url|get_nav_url}" target="<eq name='nav.target' value='1'>_blank<else/>_self</eq>">{$nav.title}</a>
                        </li>
                        </eq>
                    </think:nav>

  

posted @ 2016-09-26 22:24  靳国栋  阅读(865)  评论(0编辑  收藏  举报