2.在inculudes/lib_article.php 中
//增加搜索條件,如果有搜索內容就進行搜索
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');
這樣以后首頁就可以搜索文章了哦 版權聲明: 本站資源均來自互聯(lián)網(wǎng)或會員發(fā)布,如果侵犯了您的權益請與我們聯(lián)系,我們將在24小時內刪除!謝謝!
轉載請注明: ecshop首頁文章搜索框功能增加方法