ECShop系统后台添加/修改分类时,指定分类所使用的模板文件!
目的:为前台显示分类列表的时候指定特定的分类列表模板
过程:
1、admin/category.asp
在
$cat['style'] = !empty($_POST['style']) ? trim($_POST['style']) : '';
前添加一行
$cat['template_file']= !empty($_POST['template_file'])? trim($_POST['template_file']): '';
;有两处!一处在添加分类信息(107行左右),一处在编辑分类信息 (269行左右)
2、admin/templates/category_info.htm
在
<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>
<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"><a href="javascript:showNotice('noticeTemplate');" title="{$lang.form_notice}"><img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.notice_template}"></a>{$lang.cat_template}:</td>
<td>
<input type="text" name="template_file" value="{$cat_info.template_file|escape}" size="40" /> <br />
<span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticeTemplate">{$lang.notice_template}</span>
</td>
</tr>
<td class="label"><a href="javascript:showNotice('noticeTemplate');" title="{$lang.form_notice}"><img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.notice_template}"></a>{$lang.cat_template}:</td>
<td>
<input type="text" name="template_file" value="{$cat_info.template_file|escape}" size="40" /> <br />
<span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticeTemplate">{$lang.notice_template}</span>
</td>
</tr>
3、langeuage/zh_cn/admin/category.php
在
$_LANG['cat_style'] = '分类的样式表文件';
之前添加
$_LANG['cat_template'] = '分类的模板文件';
在
$_LANG['notice_style'] = '您可以为每一个商品分类指定一个样式表文件。例如文件存放在 themes 目录下则输入:themes/style.css';
之前添加
$_LANG['notice_template'] = '您可以为每一个商品分类指定一个模板文件,请直接输入模板名称。';
4、未完待续...(商品页面也可以根据分类来指定特定的模板)