A-A+

EcShop在不同分类调用不同模板

2012年10月03日 PHP开源系统 暂无评论 阅读 85 views 次

1.在ecs_category 表 添加 template 字段

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

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

[cc lang="html"]

模板文件:
留空为默认模板

[/code]

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,找到 if (!$smarty->is_cached('category.dwt', $cache_id)) 把 $children = get_children($cat_id); $cat = get_cat_info($cat_id); // 获得分类的相关信息移到,if (!$smarty->is_cached('category.dwt', $cache_id)) 的上一行在$cat = get_cat_info($cat_id); 的下面下加上 $template_cat = $cat['template'];if($template_cat ==''){ $template_cat = "category.dwt"; }

然后,把有 'category.dwt' 的地方,替换成 $template_cat 就可以了.

5.把需要调用的模板,在后台填写到刚加的位置就可以。

标签:

给我留言