webstermobile
Fork me on GitHub
个人博客

ECshop新增单页面模板的方法

ECshop现有的功能,通常不能满足每个客户的需求,由此,就产生了很多的ECshop二次开发,其实有些功能实现起来是很简单的。
并不是想象中的那么复杂。今天模板营就借这篇文章给大家分享一下ECshop新增单页面模板的方法。
这里以ECShop模板(默认)为例讲解,请看下面方法:
ECshop新增单页面模板
【第一步】需要在根目录创建一个php文件,您可以用原来的index.php复制一份,改名为:brandstory.php
这里的brandstory,只是我随便起的一个名字,您可以根据您的需要起一些比较有意义的名字,方便您记忆,一般与文章有关联的词语,这样前台显示的url,更有意义。
【第二步】在新创建的这个brandstory.php中,分别将文件中的以下两个位置
if (!$smarty->is_cached('index.dwt', $cache_id))
$smarty->display('index.dwt', $cache_id);
中index.dwt修改成brandstory.dwt,然后保存。
【第三步】在模板文件夹(即themes/default)里面创建brandstory.dwt文件,[注:brandstory.dwt需跟brandstory.php页面中的brandstory.dwt名称要一致,因为其代码里引用了该模板名称,建议三个地方的名称一样。]
【第四步】修改当前位置,当然,如果您不需要当前位置,可以忽略这一步。
1)找到includes/lib_main.php文件下面这个位置,
/* 积分兑换 */
elseif ('exchange' == $filename)
{
    $page_title = $GLOBALS['_LANG']['exchange'] . '_' . $page_title;
    $args       = array('wsid' => '0');
    $ur_here   .= ' <code>></code> <a href="exchange.php">' .
                    $GLOBALS['_LANG']['exchange'] . '</a>';
}
/* 其他的在这里补充 */rty->display('index.dwt', $cache_id);
在其后面补充上
/* 新增单页面 */
elseif ('brandstory' == $filename)
{
$page_title = $GLOBALS['_LANG']['brandstory'] . '_' . $page_title;
$ur_here   .= ' <code>></code> <a href="brandstory.php">' .
                                    $GLOBALS['_LANG']['brandstory'] . '</a>';
}
2)找到语言包languages/zh_cn/common.php,在最尾部?>符号前加上代码:
/* 新增单页面语言项 */
$_LANG['brandstory'] = '新增单页面';
到这步就可以在前台访问这个页面了,即http://您的网址/brandstory.php
当然,页面中的内容得由您自己在brandstory.dwt中添加,这个难度不大,懂html的用户就可以做的。

posted @ 2015-01-15 16:43  wpindesign  阅读(369)  评论(0编辑  收藏  举报