3)、修改 /admin/brand.php 文件
找到(大概在88行左右)
$sql = "INSERT INTO ".$ecs->table('brand')."(brand_name, site_url, brand_desc, brand_logo, is_show, sort_order) ". "VALUES ('$_POST[brand_name]', '$site_url', '$_POST[brand_desc]', '$img_name', '$is_show', '$_POST[sort_order]')"; $db->query($sql);
将它修改为
$sql = "INSERT INTO ".$ecs->table('brand')."(brand_name, site_url, brand_desc, brand_logo, is_show, sort_order,page_title) ". "VALUES ('$_POST[brand_name]', '$site_url', '$_POST[brand_desc]', '$img_name', '$is_show', '$_POST[sort_order]'),'$_post[page_title]'"; $db->query($sql);
继续找到(大概在113行左右)
$sql = "SELECT brand_id, brand_name, site_url, brand_logo, brand_desc, brand_logo, is_show, sort_order ". "FROM " .$ecs->table('brand'). " WHERE brand_id='$_REQUEST[id]'"; $brand = $db->GetRow($sql);
将之修改为
$sql = "SELECT brand_id, brand_name, site_url, brand_logo, brand_desc, brand_logo, is_show, sort_order,page_title ". "FROM " .$ecs->table('brand'). " WHERE brand_id='$_REQUEST[id]'"; $brand = $db->GetRow($sql);
继续向下找到
/* 处理图片 */ $img_name = basename($image->upload_image($_FILES['brand_logo'],'brandlogo')); $param = "brand_name = '$_POST[brand_name]', site_url='$site_url', brand_desc='$_POST[brand_desc]', is_show='$is_show', sort_order='$_POST[sort_order]' ";
将它修改成下面代码
/* 处理图片 */ $img_name = basename($image->upload_image($_FILES['brand_logo'],'brandlogo')); $param = "brand_name = '$_POST[brand_name]', site_url='$site_url', brand_desc='$_POST[brand_desc]', is_show='$is_show', sort_order='$_POST[sort_order]',page_title='$_POST[page_title]' ";
4)、
修改前台程序文件 /brand.php
将
$smarty->assign('page_title', $position['title']); // 页面标题
修改为
$smarty->assign('page_title', htmlspecialchars($brand_info['page_title'])); // 页面标题
5)、大功告成,可以看看效果了。
4、ECSHOP商品详细页自定义TITLE方法
修改教程牵涉到的修改文件
/admin/templates/goods_info.htm
/admin/goods.php
/goods.php
修改步骤:
1:后台运行sql语句,admin后台->左侧导航->数据库管理->SQL查询
运行下面的语句(只能运行一次,小心):
alter table ecs_goods add seo_title text not null
2:修改 admin/templates/goods_info.htm
在此文件的第44行后面,加上下面几行
<tr> <td class="label">自定义title</td> <td> <input type="text" name="seo_title" value="{$goods.seo_title}" size="30" /> </td> </tr>
3:修改admin/goods.php,搜索“rank_integral”在SQL语句那里修改,
需要修改四处,在833行找到
"is_on_sale, is_alone_sale, is_shipping, goods_desc, add_time, last_update, goods_type, rank_integral, seo_title,suppliers_id)" .
修改成
"is_on_sale, is_alone_sale, is_shipping, goods_desc, add_time, last_update, goods_type, rank_integral, seo_title,suppliers_id)" .
找到839行找到
" '$_POST[goods_desc]', '" . gmtime() . "', '". gmtime() ."', '$goods_type', '$rank_integral','$suppliers_id')";
修改成
" '$_POST[goods_desc]', '" . gmtime() . "', '". gmtime() ."', '$goods_type', '$rank_integral', '$_POST[seo_title]','$suppliers_id')";
847行找到
"is_on_sale, is_alone_sale, is_shipping, goods_desc, add_time, last_update, goods_type, extension_code, rank_integral)" .
修改成
"is_on_sale, is_alone_sale, is_shipping, goods_desc, add_time, last_update, goods_type, extension_code, rank_integral,seo_title)" .
853行
" '$_POST[goods_desc]', '" . gmtime() . "', '". gmtime() ."', '$goods_type', '$code', '$rank_integral')";
修改成
" '$_POST[goods_desc]', '" . gmtime() . "', '". gmtime() ."', '$goods_type', '$code', '$rank_integral','$_POST[seo_title]')";
搜索
"rank_integral = '$rank_integral', " .
在下方加代码
"seo_title='$_POST[seo_title]',".
4:修改根目录goods.php的第242行
搜索// 页面标题
把代码
$smarty->assign('page_title', $position['title']); // 页面标题
替换成
$smarty->assign('page_title', trim($goods['seo_title'])?$goods['seo_title']:$position['title']); // 页面标题
清除缓存大攻造成!
(责任编辑:最模板) |