zoukankan      html  css  js  c++  java
  • ECshop通过文章分类的ID实现不同模板

    在做项目的时候,不得不承认Ecshop确实很强大,当客户需要想要用不同模板来实现文章页面时,就可以体现出Ecshop的强大之处。经过在百度上搜索了解到,文章需要实现不同模板,着手点就是它的分类ID。直接通过分类ID来判断,一下就是方法:

    【第一】:打开根目录下的article_cat.php找到:

    代码如下:

    $smarty->display('article_cat.dwt', $cache_id);



    修改如下:
    [方法一]
    1. switch($cat_id){
    2. case 1: //当文章分类ID等于1时,输出article_cat1.dwt模板。
    3. $smarty->display('article_cat1.dwt', $cache_id);
    4. break;
    5. default:
    6. $smarty->display('article_cat.dwt', $cache_id);
    7. //当文章分类ID不等于1时,输出article_cat.dwt模板。
    8. }
    复制代码
    [方法二]
    1. if($cat_id > 9)
    2. {
    3.     $smarty->display('article_cat1.dwt', $cache_id);
    4. }
    5. else if($cat_id > 2 && $cat_id <= 9)
    6. {
    7.     $smarty->display('article_cat2.dwt', $cache_id);
    8. }
    9. else if($cat_id ==1 || $cat_id ==2)
    10. {
    11.     $smarty->display('article_cat3.dwt', $cache_id);
    12. }
    复制代码
    当文章分类ID大于9时,输出article_cat1.dwt模板;
    当文章分类ID大于2和小于等于9时,输出article_cat2.dwt模板;
    当文章分类ID等于1或者等于2时,输出输出article_cat3.dwt模板。
  • 相关阅读:
    Nim or not Nim? hdu3032 SG值打表找规律
    Maximum 贪心
    The Super Powers
    LCM Cardinality 暴力
    Longge's problem poj2480 欧拉函数,gcd
    GCD hdu2588
    Perfect Pth Powers poj1730
    6656 Watching the Kangaroo
    yield 小用
    wpf DropDownButton 源码
  • 原文地址:https://www.cnblogs.com/zhicheng/p/4362109.html
Copyright © 2011-2022 走看看