chengkun
2025-04-29 a34a90f03cecc7658231547270f8036bb5affe4a
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
<?php
class Smarty_Internal_Compile_Singlenav extends Smarty_Internal_CompileBase{
    public $required_attributes = array('from', '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);
        }
        
        $OutputStr='global $db,$db_config,$config;$List=array();
        $Query = $db->query("SELECT * FROM $db_config[def]description where is_nav=\'1\' order by sort asc");
        while($rs = $db->fetch_array($Query)){
            $rs[\'url\']=$config[\'sy_weburl\']."/".$rs[\'url\'];
            $List[] =  $rs;
        }';
 
        return SmartyOutputStr($this,$compiler,$_attr,'singlenav','$List',$OutputStr,'$List');
    }
}
class Smarty_Internal_Compile_Singlenavelse extends Smarty_Internal_CompileBase{
    public function compile($args, $compiler, $parameter){
        $_attr = $this->getAttributes($compiler, $args);
 
        list($openTag, $nocache, $item, $key) = $this->closeTag($compiler, array('foreach'));
        $this->openTag($compiler, 'foreachelse', array('foreachelse', $nocache, $item, $key));
 
        return "<?php }\nif (!\$_smarty_tpl->tpl_vars[$item]->_loop) {\n?>";
    }
}
class Smarty_Internal_Compile_Singlenavclose 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('foreach', 'foreachelse'));
 
        return "<?php } ?>";
    }
}