zoukankan      html  css  js  c++  java
  • ECSHOP不同商品分类调用不同模板

    1.在ecs_category 表 添加 template 字段



        可以在后台运行sql语句:alter table `ecs_category` Add column template text NOT NULL AFTER `style`

    前缀自己改



    2.打开admin/templates/category_info.htm 文件,分类的样式表文件 的下一行,加放以下代码

    搜索:javascript:showNotice('noticeGoodsSN') 找到:大概在128行

          <tr>
            <td class="label"><a href="javascript:showNotice('noticeGoodsSN');" title="{$lang.form_notice}"><img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.notice_style}"></a>{$lang.cat_style}:</td>
            <td>
              <input type="text" name="style" value="{$cat_info.style|escape}" size="40" /> <br />
              <span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticeGoodsSN">{$lang.notice_style}</span>
            </td>
          </tr>

    下方增加:

        <tr>  
        <td class="label">分类模板:</td>  
        <td>  
        <input type="text" name="template" value="{$cat_info.template|escape}" size="40" /> <br />  
        <span class="notice-span">留空为默认模板</span>  
        </td>  
        </tr> 

    3.打开admin/category.php

    搜索:$cat['style'] = !empty($_POST['style']) ? trim($_POST['style']) : '';

    找到 (一共两个地方)

    在下面加上
    $cat['template'] = !empty($_POST['template']) ? trim($_POST['template']) : '';

    4.打开category.php

      找到  function get_cat_info($cat_id),要在下面的sql语句里找到 cat_desc, style 在后面加上 ,template

    大概在432行:cat_desc, style, template,  grade,

    搜索:assign_dynamic('category'); // 动态内容

    下方找到:$smarty->display('category.dwt', $cache_id);

    //修改
      $categorys = $cat['template'] ? $cat['template'] : 'category.dwt'; 
      $smarty->display($categorys, $cache_id);

  • 相关阅读:
    Mybatis框架中Mapper文件传值参数获取。【Mybatis】
    Mybatis传多个参数(三种解决方案)
    eclipse工程当中的.classpath 和.project文件什么作用?
    在Eclipse中显示.project和.classpath和.setting目录
    eclipse项目中.classpath文件详解
    postgres 错误duplicate key value violates unique constraint 解决方案
    Java反射机制
    【深入Java虚拟机】之二:Class类文件结构
    JVM-类加载机制
    sql 替换字段中的部分字符,替换指定字符
  • 原文地址:https://www.cnblogs.com/freeze89/p/4613626.html
Copyright © 2011-2022 走看看