ecshop首页 怎么在产品搜索处加文章搜索框
展开全部
1.在inculudes/lib_article.php 中
找出下列语句,并修改。【约42行】
//增加搜索条件,如果有搜索内容就进行搜索
if ($requirement != '')
{
$sql = 'SELECT article_id, title, author, add_time, file_url, open_type' .
' FROM ' .$GLOBALS['ecs']->table('article') .
' WHERE is_open = 1 AND ' . $cat_str . ' AND title like \'%' . $requirement . '%\' .//本行为要修改语句 Edited by Lingfeng
' ORDER BY article_type DESC, article_id DESC';
}
所修改句子为:
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
' WHERE is_open = 1 AND ' . $cat_str . ' AND (title like \'%' . $requirement . '%\' or content like \'%' . $requirement . '%\' )' .
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
2.再找出:
function get_article_count($cat_id ,$requirement='')
{
global $db, $ecs;
if ($requirement != '')
{
$count = $db->getOne('SELECT COUNT(*) FROM ' . $ecs->table('article') . ' WHERE ' . get_article_children($cat_id) . ' AND title like \'%' . $requirement . '%\' and is_open = 1');
}
所修改后句子为:
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
$count = $db->getOne('SELECT COUNT(*) FROM ' . $ecs->table('article') . ' WHERE ' . get_article_children($cat_id) . ' AND ( title like \'%' . $requirement . '%\' or content like \'%' . $requirement . '%\') AND is_open = 1');
-------------------------------------------------------------------
找出下列语句,并修改。【约42行】
//增加搜索条件,如果有搜索内容就进行搜索
if ($requirement != '')
{
$sql = 'SELECT article_id, title, author, add_time, file_url, open_type' .
' FROM ' .$GLOBALS['ecs']->table('article') .
' WHERE is_open = 1 AND ' . $cat_str . ' AND title like \'%' . $requirement . '%\' .//本行为要修改语句 Edited by Lingfeng
' ORDER BY article_type DESC, article_id DESC';
}
所修改句子为:
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
' WHERE is_open = 1 AND ' . $cat_str . ' AND (title like \'%' . $requirement . '%\' or content like \'%' . $requirement . '%\' )' .
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
2.再找出:
function get_article_count($cat_id ,$requirement='')
{
global $db, $ecs;
if ($requirement != '')
{
$count = $db->getOne('SELECT COUNT(*) FROM ' . $ecs->table('article') . ' WHERE ' . get_article_children($cat_id) . ' AND title like \'%' . $requirement . '%\' and is_open = 1');
}
所修改后句子为:
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
$count = $db->getOne('SELECT COUNT(*) FROM ' . $ecs->table('article') . ' WHERE ' . get_article_children($cat_id) . ' AND ( title like \'%' . $requirement . '%\' or content like \'%' . $requirement . '%\') AND is_open = 1');
-------------------------------------------------------------------
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询