分析修改ecshop模板名称

更新时间:2012-09-12 点击量:2797

ecshop模板都是采用插件的形式,所以加入和删除模板只需要在模板文件中直接加入或者删除就可以了,ecshop的模板插件开发的十分巧妙,下面将分析ecshop模板插件,将对模板的名称,图片,时间等做一些修改技巧.

首先,找到admin/include/lib_template.php文件,找到get_template_info()函数,找到以下代码

$css_path = '../themes/' . $template_name . '/style.css';
if ($template_style != '')
{
$css_path = '../themes/' . $template_name . "/style_$template_style.css";
}

if (file_exists($css_path) && !empty($template_name))
{
$arr = array_slice(file($css_path), 0, 10);

$template_name      = explode(': ', $arr[1]);
$template_uri       = explode(': ', $arr[2]);
$template_desc      = explode(': ', $arr[3]);
$template_version   = explode(': ', $arr[4]);
$template_author    = explode(': ', $arr[5]);
$author_uri         = explode(': ', $arr[6]);
$logo_filename      = explode(': ', $arr[7]);
$template_type      = explode(': ', $arr[8]);
$info['name']       = isset($template_name[1]) ? trim($template_name[1]) : '';
$info['uri']        = isset($template_uri[1]) ? trim($template_uri[1]) : '';
$info['desc']       = isset($template_desc[1]) ? trim($template_desc[1]) : '';
$info['version']    = isset($template_version[1]) ? trim($template_version[1]) : '';
$info['author']     = isset($template_author[1]) ? trim($template_author[1]) : '';
$info['author_uri'] = isset($author_uri[1]) ? trim($author_uri[1]) : '';
$info['logo']       = isset($logo_filename[1]) ? trim($logo_filename[1]) : '';
$info['type']       = isset($template_type[1]) ? trim($template_type[1]) : '';

}
else
{
$info['name']       = '';
$info['uri']        = '';
$info['desc']       = '';
$info['version']    = '';
$info['author']     = '';
$info['author_uri'] = '';
$info['logo']       = '';
}
通过 $arr = array_slice(file($css_path), 0, 10), 你可以发现,模板在后台显示的名称由 $template_name      = explode(': ', $arr[1]);来控制的。所有的信息在style.css中.

打开模板下的样式,你会发现有下信息

/*
Template Name: tttt
Template URI: /> Description: 默认升级版.
Version: 2.7.0
Author: ecshop Team
Author URI: /> Logo filename: logo.gif
Template Type: type_0
*/
你就可以发现,你能对这个文件修改,进行如下的操作:

(1)如何修改模板名称:

回答:将style.css中Template Name: tttt中的tttt修改为你需要的模板名称

(2)如何修改模板图片

回答:'../themes/' . $template_name . "/images/screenshot.$val";你可以发现,可以修改模板images目录下screenshot.gif,或者是'png', 'gif', 'jpg', 'jpeg'这些后缀的文件名称

支付宝扫码打赏 微信打赏

如果文章对您有帮助,就打赏一个吧

在线客服

客户服务

热线电话:

13128985956 服务时间:

周一到周六:9:00-18:00

在线QQ客服

在线微信客服

关于我们 常见问题

支付方式 加盟合作

提交需求
优惠红包 购物车0 反馈留言 返回顶部