您现在的位置是:首页 > 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表单在火狐浏览器下无法刷新重置的修复方法
这个问题不是ecshop系统独有的,其他所有涉及到表单的页面都会出现类似问题:问题现象为:在火狐浏览器下,ECSHOP表单无法刷新重置。
ecshop后台会员列表增加显示会员等级
目前的ECSHOP系统后台的会员列表默认是不显示会员等级的,它只是在会员搜索功能里面提供了一个按照“会员等级”搜索的功能,这样显示的有些不支援
ecshop文章日期文章时间修改和添加文章时间日期选择方法
代码号讲解下ecshop文章日期时间修改和选择,大家都知道ECSHOP商城添加文章时候没有文章日期和文章时间选择,同时也不能修改文章日期和文章时间代码号今天教大家
相关源码
-
(PC+WAP)pbootcms模板黑色门窗定制五金建材网站下载为门窗定制与五金建材企业设计的网站解决方案,采用PbootCMS开发,兼具专业展示与营销功能。黑色系设计突显工业质感,响应式布局确保在手机、平板等设备上的浏览体验。通过简单的内容替换,也可适用于建材贸易、家具定制等相关行业。查看源码 -
(PC+WAP)玻璃钢不锈钢钢材环保设备pbootcms网站模板采用PbootCMS内核开发的响应式网站模板,为玻璃钢环保设备制造、不锈钢钢材贸易企业设计,适配产品展示及企业服务场景。通过自适应技术实现PC与WAP端数据实时同步查看源码 -
HTML5响应式健身俱乐部pbootcms网站模板下载为健身俱乐部、瑜伽中心及运动场馆设计的响应式网站模板,采用PbootCMS内核开发,支持一键替换图文适配健身器材销售、瑜伽工作室等多类型运动健康产业。查看源码 -
(响应式)企业管理人力资源服务类pbootcms模板源码下载为人力资源服务及企业管理设计的响应式网站模板,基于PbootCMS内核开发。通过宽屏布局优化岗位展示效果,简洁界面聚焦人才服务核心业务,自适应技术确保在PC端与手机端查看源码 -
(PC+WAP)蓝色电子半导体电子设备网站pbootcms源码下载本模板基于PbootCMS内核开发,为半导体和电子科技行业设计,特别适合电子元器件、集成电路、半导体设备及相关技术产品展示。查看源码 -
(自适应多语言)WordPress开源主题MirageV资讯个人博客源码MirageV资讯类个人博客主题源码/WordPress主题/全开源MirageV 是一款开源的 WordPress 主题,支持自适应、暗黑模式、多语言等功能,查看源码
| 分享笔记 (共有 篇笔记) |
