ecshop二次开发--左侧导航

1.进入ecshop->uoload->theme->default->library->category_tree.lbi将里边的代码清空,并且将以下代码复制到进去


    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
      
    <div class="box">  
      
    <input type="button" id="button1" value="商品分类" style="width:60px;font-size:12px" />  
      
    <input type="button" id="button2" value="品牌分类" style="width:60px;font-size:12px"/>  
      
    <input type="button" id="button3" value="供货商" style="width:50px;font-size:12px"/>  
      
    <div class="box_1" id="ce1">  
      
       
      
    <div id="category_tree">  
      
    <!--{foreach from=$categories item=cat}-->  
      
    <dl>  
      
    <dt><a href="{$cat.url}">{$cat.name|escape:html}</a></dt>  
      
    <!--{foreach from=$cat.cat_id item=child}-->  
      
    <dd><a href="{$child.url}">{$child.name|escape:html}</a></dd>  
      
    <!--{foreach from=$child.cat_id item=childer}-->  
      
    <dd>  <a href="{$childer.url}">{$childer.name|escape:html}</a></dd>  
      
    <!--{/foreach}-->  
      
    <!--{/foreach}-->  
      
    </dl>  
      
    <!--{/foreach}-->  
      
    </div>  
      
    </div>  
      
    <div class="box_1" id="ce2" style="display:none">  
      
    <div id="category_tree">  
      
    <!--{foreach from=$前边所传过来的数据(sql) item=起个名称(aa)}-->  
      
    <dl>  
      
    <dd><a href="#">{$起个名称(aa).数据库名称(brand_name)}</a></dd>  
      
    </dl>  
      
    <!--{/foreach}-->  
      
    </div>  
      
    </div>  
      
       
      
    <div class="box_1" id="ce3" style="display:none">  
      
    <div id="category_tree">  
      
    <!--{foreach from=$categories item=cat}-->  
      
    <dl>  
      
    <dd><a href="#">供货商测试</a></dd>  
      
    </dl>  
      
    <!--{/foreach}-->  
      
    </div>  
      
    </div>  
      
      
    <div class="blank5"></div>  
      
    <script>  
      
      var button1=document.getElementById('button1');  
      
      var button2=document.getElementById('button2');  
      
      var button3=document.getElementById('button3');  
      
      var ce1=document.getElementById('ce1');  
      
      var ce2=document.getElementById('ce2');  
      
      var ce3=document.getElementById('ce3');  
      
      button1.οnclick=function(){  
      
          ce2.style="display:none";  
      
          ce3.style="display:none";  
      
          ce1.style="display:block";  
      
      }  
      
       button2.οnclick=function(){  
      
          ce2.style="display:block";  
      
          ce3.style="display:none";  
      
          ce1.style="display:none";  
      
      }  
      
      button3.οnclick=function(){  
      
          ce2.style="display:none";  
      
          ce3.style="display:block";  
      
          ce1.style="display:none";  
      
      }  
      
    </script>  

2.然后在index.php中进行sql查询并且将值传到后边

在index.php中搜索到这些代码if (!$smarty->is_cached('index.dwt', $cache_id))在这里边进行sql查询

    $sql="select * from ecs_brand";  
     $add = $db->getAll($sql);  
     $sqls="select * from".$ecs->table("suppliers");  
     $adds = $db->getAll($sqls);  
     $smarty->assign('sqls', $adds);  
     $smarty->assign('sql', $add);  
     assign_template();  



3.




























































评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值