chengkun
2025-05-26 8f3df543230cd4403368b39b9bbe5726d11a0284
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
class Smarty_Internal_Compile_Navmap extends Smarty_Internal_CompileBase{
    public $required_attributes = array('item');
    public $optional_attributes = array('name', 'key');
    public $shorttag_order = array('from', 'item', 'key', 'name');
    public function compile($args, $compiler, $parameter){
        $_attr = $this->getAttributes($compiler, $args);
 
        $from = $_attr['from'];
        $item = $_attr['item'];
        if (!strncmp("\$_smarty_tpl->tpl_vars[$item]", $from, strlen($item) + 24)) {
            $compiler->trigger_template_error("item variable {$item} may not be the same variable as at 'from'", $compiler->lex->taglineno);
        }
 
        //自定义标签START
        $OutputStr='global $db,$db_config,$config;$paramer='.ArrayToString($_attr,true).';
        include(PLUS_PATH."/navmap.cache.php");$Navlist=array();
        if(is_array($navmap)){
            $ParamerArr = GetSmarty($paramer,$_GET,$_smarty_tpl);
            $paramer = $ParamerArr[arr];
            $Purl =  $ParamerArr[purl];
        }
        //默认调用头部导航
        $Navlist =$navmap[0];
        if(is_array($navmap)){
            foreach($navmap as $k=>$v){
                foreach($Navlist as $key=>$val){
                    if($k==$val[id]){
                        foreach($v as $kk=>$value){
                            if($value[type]==\'1\'){
                                if($config[sy_seo_rewrite]=="1" && $value[furl]!=\'\'){
                                    $v[$kk][url] = $config[sy_weburl]."/".$value[furl];
                                }else{
                                    $v[$kk][url] = $config[sy_weburl]."/".$value[url];
                                }
                            }
                        }
                        $Navlist[$key][\'list\'][]=$v;
                    }
                }
            }
            foreach($Navlist as $key=>$value){
                if($value[type]==\'1\'){
                    if($config[sy_seo_rewrite]=="1" && $value[furl]!=\'\'){
                        $Navlist[$key][url] = $config[sy_weburl]."/".$value[furl];
                    }else{
                        $Navlist[$key][url] = $config[sy_weburl]."/".$value[url];
                    }
                }
            }
        }';
 
        return SmartyOutputStr($this,$compiler,$_attr,'navmap','$Navlist',$OutputStr,'$Navlist');
    }
}
class Smarty_Internal_Compile_Navmapelse extends Smarty_Internal_CompileBase{
    public function compile($args, $compiler, $parameter){
        $_attr = $this->getAttributes($compiler, $args);
 
        list($openTag, $nocache, $item, $key) = $this->closeTag($compiler, array('navmap'));
        $this->openTag($compiler, 'navmapelse', array('navmapelse', $nocache, $item, $key));
 
        return "<?php }\nif (!\$_smarty_tpl->tpl_vars[$item]->_loop) {\n?>";
    }
}
class Smarty_Internal_Compile_Navmapclose extends Smarty_Internal_CompileBase{
    public function compile($args, $compiler, $parameter){
        $_attr = $this->getAttributes($compiler, $args);
        if ($compiler->nocache) {
            $compiler->tag_nocache = true;
        }
 
        list($openTag, $compiler->nocache, $item, $key) = $this->closeTag($compiler, array('navmap', 'navmapelse'));
 
        return "<?php } ?>";
    }
}