########### 更新首页面装饰知识栏目 ############
update_page("../index_two.phtml","装饰知识","select * from home_news order by post_time desc",10,'');
########### 更新首页面新闻栏目 ############
update_page("../index_one.phtml","家居新闻","select title,link_id from news_main where cate like '%装饰装修%' order by post_date desc",10,"http://news.0731fdc.com/decorate");
######## 提取相关知识标题 ########
$C_key_sql = "select count(id) from home_news where title like '%$keyword%' order by post_time desc";
$DB -> query($C_key_sql);
$DB -> next_record();
$count = $DB -> f("count(id)");
$key_sql = "select title,link_id from home_news where title like '%$keyword%' order by post_time desc";
$DB -> query($key_sql);
for ($w=0;$w<6;$w++){
if ($w<$count){
$DB -> next_record();
$link_id[$w] = $DB -> f("link_id");
$title_kn .= "<img src='/images/red_logo.jpg' width=4 height=4> <a href='".$link_id[$w]."' class=blackl>".$DB -> f("title")."</a><br>";
}
}
$title_str = "<!-- 相关知识 Start-->.*<!-- 相关知识 End-->";
ereg($title_str,$main_str,$regs);
$main_str = str_replace($regs[0],"<!-- 相关知识 Start-->".$title_kn."<!-- 相关知识 End-->",$main_str);
######## 提取热点推荐标题 ########
$C_hot_sql = "select count(id) from home_news where title like '%新潮%' or title like '%时尚%' or title like '%装修%' or title like '%装饰%' or title like '%流行%' order by post_time desc";
$DB -> query($C_hot_sql);
$DB -> next_record();
$count_hot = $DB -> f("count(id)");
$hot_sql = "select title,link_id from home_news where title like '%新潮%' or title like '%时尚%' or title like '%装修%' or title like '%装饰%' or title like '%流行%' order by post_time desc";
$DB -> query($hot_sql);
for ($i=0;$i<6;$i++){
if ($i<$count_hot){
$DB -> next_record();
$link_id_hot[$i] = $DB -> f("link_id");
$title_kn_hot .= "<img src='/images/red_logo.jpg' width=4 height=4> <a href='".$link_id_hot[$i]."' class=blackl>".$DB -> f("title")."</a><br>";
} }
$title_str = "<!-- 热点推荐 Start-->.*<!-- 热点推荐 End-->";
ereg($title_str,$main_str,$regs);
$main_str = str_replace($regs[0],"<!-- 热点推荐 Start-->".$title_kn_hot."<!-- 热点推荐 End-->",$main_str);