您现在的位置是:首页 > cms教程 > Ecshop商城教程Ecshop商城教程
ecshop文章标题文字增加颜色样式修改方法
龚开梦2023-12-31Ecshop商城教程已有人查阅
导读ecshop 默认只有商品名称有样式,为了能让文章也有特 的标题,开发以下插件为文章标题加样式文章标题加样式修改:
ecshop 默认只有商品名称有样式,为了能让文章也有特 的标题,开发以下插件为文章标题加样式文章标题加样式修改:
1、
并把里面的
document.getElementById("goods_name_color").value = this.bgColor;
document.getElementsByName("goods_name").item(0).style.color = this.bgColor;
改成
document.getElementById("title_color").value = this.bgColor;//文章标题加样式 by neo
document.getElementsByName("title").item(0).style.color = this.bgColor;//文章标题加样式 by neo
4、admin\templates\article_info.htm
页面顶部加入,colorselector2.js
如下效果:
{include file="pageheader.htm"}
{insert_scripts files="../js/utils.js,selectzone.js,colorselector2.js,validator.js"}<!-- 文章标题加样式 by neo -->
再找到
1).找到
require_once(ROOT_PATH . 'includes/cls_image.php');
下加入
$image = new cls_image($_CFG['bgcolor']);//文章标题加样式 by neo
2).找到(有2处都需要改)
$smarty->assign('article', $article);
上加入
前台php部分:在要实现文章标题样式页面找到对应的php添加查询的字段 title_style 和 循环时添加
{$article.short_title_style}
或者
{$article.title_style}
1、index.php
找到
function index_get_new_articles()
里面的sql添加 , a.title_style 这个字段进去
如:
1、
ALTER TABLE `ecs_article` ADD `title_style` VARCHAR( 60 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '+'
2、languages\zh_cn\admin\article.php 加入语言
//文章标题加样式 by neo
$_LANG['select_font'] = '字体样式';
$_LANG['font_styles'] = array('strong' => '加粗', 'em' => '斜体', 'u' => '下划线', 'strike' => '删除线');
$_LANG['js_languages']['cancel_color'] = '无样式';
3、admin\js\colorselector.js 一个,改名 colorselector2.js并把里面的
document.getElementById("goods_name_color").value = this.bgColor;
document.getElementsByName("goods_name").item(0).style.color = this.bgColor;
改成
document.getElementById("title_color").value = this.bgColor;//文章标题加样式 by neo
document.getElementsByName("title").item(0).style.color = this.bgColor;//文章标题加样式 by neo
4、admin\templates\article_info.htm
页面顶部加入,colorselector2.js
如下效果:
{include file="pageheader.htm"}
{insert_scripts files="../js/utils.js,selectzone.js,colorselector2.js,validator.js"}<!-- 文章标题加样式 by neo -->
再找到
<tr>
<td class="narrow-label">{$lang.title}</td>
<td><input type="text" name="title" size ="40" maxlength="60" value="{$article.title|escape}" />{$lang.require_field}</td>
</tr>
修改成
<!-- 文章标题加样式 by neo -->
<tr>
<td class="label">{$lang.title}</td>
<td>
<input type="text" name="title" value="{$article.title|escape}" style="float:left;color:{$title_color};" size="30" />
<div style="background-color:{$title_color};float:left;margin-left:2px;" id="font_color" onclick="ColorSelecter.Show(this);"><img src="images/color_selecter.gif" style="margin-top:-1px;" /></div>
<input type="hidden" id="title_color" name="title_color" value="{$title_color}" />
<select name="title_style">
<option value="">{$lang.select_font}</option>
{html_options options=$lang.font_styles selected=$title_style}
</select>
{$lang.require_field}
</td>
</tr>
<!-- 文章标题加样式 by neo -->
5、admin\article.php1).找到
require_once(ROOT_PATH . 'includes/cls_image.php');
下加入
$image = new cls_image($_CFG['bgcolor']);//文章标题加样式 by neo
2).找到(有2处都需要改)
$smarty->assign('article', $article);
上加入
/* 文章标题加样式 by neo */
$title_style = explode('+', empty($article['title_style']) ? '+' : $article['title_style']);
$smarty->assign('title_color', $title_style[0]);
$smarty->assign('title_style', $title_style[1]);
3).找到
$sql = "INSERT INTO ".$ecs->table('article')."(title, cat_id, article_type, is_open, author, ".
"author_email, keywords, content, add_time, file_url, open_type, link, description) ".
"VALUES ('$_POST[title]', '$_POST[article_cat]', '$_POST[article_type]', '$_POST[is_open]', ".
"'$_POST[author]', '$_POST[author_email]', '$_POST[keywords]', '$_POST[FCKeditor1]', ".
"'$add_time', '$file_url', '$open_type', '$_POST[link_url]', '$_POST[description]')";
修改成
$title_style = $_POST['title_color'] . '+' . $_POST['title_style'];//文章标题加样式 by neo
$sql = "INSERT INTO ".$ecs->table('article')."(title, cat_id, article_type, is_open, author, ".
"author_email, keywords, content, add_time, file_url, open_type, link, description, title_style) ".
"VALUES ('$_POST[title]', '$_POST[article_cat]', '$_POST[article_type]', '$_POST[is_open]', ".
"'$_POST[author]', '$_POST[author_email]', '$_POST[keywords]', '$_POST[FCKeditor1]', ".
"'$add_time', '$file_url', '$open_type', '$_POST[link_url]', '$_POST[description]', '$title_style')";
4).找到
if ($exc->edit("title='$_POST[title]', cat_id='$_POST[article_cat]', article_type='$_POST[article_type]', is_open='$_POST[is_open]', author='$_POST[author]', author_email='$_POST[author_email]', keywords ='$_POST[keywords]', file_url ='$file_url', open_type='$open_type', content='$_POST[FCKeditor1]', link='$_POST[link_url]', description = '$_POST[description]'", $_POST['id']))
修改成
$title_style = $_POST['title_color'] . '+' . $_POST['title_style'];//文章标题加样式 by neo
if ($exc->edit("title='$_POST[title]', cat_id='$_POST[article_cat]', article_type='$_POST[article_type]', is_open='$_POST[is_open]', author='$_POST[author]', author_email='$_POST[author_email]', keywords ='$_POST[keywords]', file_url ='$file_url', open_type='$open_type', content='$_POST[FCKeditor1]', link='$_POST[link_url]', description = '$_POST[description]', title_style = '$title_style'", $_POST['id']))
======================以上步骤能实现了后台的文章标题样式添加和修改============================前台php部分:在要实现文章标题样式页面找到对应的php添加查询的字段 title_style 和 循环时添加
$arr[$article_id]['title_style'] = add_style($row['title'],$row['title_style']);//文章标题加样式 by neo
$arr[$article_id]['short_title_style'] = add_style($arr[$article_id]['short_title'],$row['title_style']);//文章标题加样式 by neo
前台dwt,lbi模板部分{$article.short_title_style}
或者
{$article.title_style}
1、index.php
找到
function index_get_new_articles()
里面的sql添加 , a.title_style 这个字段进去
如:
$sql = 'SELECT a.article_id, a.title, a.title_style, ac.cat_name, a.add_time, a.file_url, a.open_type, ac.cat_id, ac.cat_name ' .
' FROM ' . $GLOBALS['ecs']->table('article') . ' AS a, ' .
$GLOBALS['ecs']->table('article_cat') . ' AS ac' .
' WHERE a.is_open = 1 AND a.cat_id = ac.cat_id AND ac.cat_type = 1' .
' ORDER BY a.article_type DESC, a.add_time DESC LIMIT ' . $GLOBALS['_CFG']['article_number'];
在里面foreach里添加
$arr[$idx]['title_style'] = add_style($row['title'],$row['title_style']);//文章标题加样式 by neo
$arr[$idx]['short_title_style'] = add_style($arr[$idx]['short_title'],$row['title_style']);//文章标题加样式 by neo
本文标签:
很赞哦! ()
相关教程
图文教程
ecshop商品列表页商品显示商品品牌
通过本教程实现ECSHOP商品列表中每个商品都显示品牌 步:打开根目录gh category.php 文件查找:$sql = SELECT g.good
ecshop商品列表商品按后台推荐排序大小排序教程
Ecshop修改商品分类页的排序方式为推荐排序要修改Ecshop商品分类页图片的排序方式,我们只需要修改Ecshop里
ecshop注册用户送红包系统实现自动给新会员送红包
功能介绍:新用户成功注册之后,系统自动赠送红包,用户在会员中心就可以查看到红包,而管理员不用手动的在后台按会员发放。
ecshop模板标签总结,ecshop模板标签手册
先从index.php主页开始页面关键字 {$keywords }页面标题 {$page_title}产品分类父分类列表 {foreach fro
相关源码
-
(自适应响应式)英文外贸医疗科研耗材设备pbootcms网站模板为医疗设备和外贸企业设计的响应式网站模板,基于PbootCMS系统开发。突出医疗产品认证展示和国际化特性,通过专业化的产品参数展示模块和文档管理系统,满足医疗行业严格的信息披露要求。查看源码 -
(PC+WAP)蓝色五金机械设备营销型网站源码下载基于PbootCMS内核开发的营销型企业网站模板,为五金机械设备类企业打造,通过标准化数字展示提升客户转化率。模板采用模块化设计,可快速适配机床工具、建筑五金、阀门管件等细分领域。查看源码 -
帝国cms7.5品牌连锁店招商加盟商机网站模版源码本模板为招商加盟、创业投资、品牌连锁等商业领域设计,采用帝国CMS7.5内核构建,整体风格简洁大气,突出商业信任感与专业度,适合各类招商加盟项目展示、品牌连锁店宣传等商业应用场景。查看源码 -
(自适应)工业机械制造设备网站pbootcms模板下载为机械制造、工业设备类企业设计,特别适合各类机械设备、生产线、工业自动化产品展示。采用响应式技术,确保在不同设备上都能清晰展示机械产品的技术参数和细节特点。查看源码 -
(PC+WAP)蓝色电缆桥架五金钢结构机械PbootCMS模板下载采用PC与WAP双端适配设计,满足桌面设备和移动端访问需求。专注服务于电缆桥架、钢结构及五金机械制造领域,通过结构化布局展示产品特性与技术参数,后台数据一体化管理提升内容维护效率。查看源码 -
(自适应响应式)APP应用程序软件介绍落地页源码免费下载该模板为营销技术从业者设计,提供专业的内容展示平台。采用响应式布局,适配软件介绍、APP推广等营销场景,通过可视化后台可快速搭建符合行业特性的展示网站。查看源码
| 分享笔记 (共有 篇笔记) |
