帝國CMS沒有相關信息時調用其它信息教程建站知
導讀:1建站知識帝國CMS模板網下面的帝國CMS教程欄目為您提供了帝國CMS沒有相關信息時調用其它信息教程網站推廣優化seo網站優化seo培訓。
帝國cms默認的[!--other.link--]標簽調用相關鏈接時,如果沒有相關鏈接的話,則會顯示“暫無相關鏈接”。對于一些采集站或其他需要增加內鏈的網站來說,此時最好能調用本欄目的其它一些信息填充進來。這里分享一個自己用的函數,實現這個功能。
當信息有相關信息時,調用相關信息,如果沒有,則調用同欄目、當前信息前后100個id之內的信息中發布時間最靠近的,100可以設置成參數。將此函數放進 userfun.php 文件中,
function dp_GetKeyboard($num=100){ global $empire,$public_r,$class_r,$fun_r,$dbtbpre,$class_r,$navinfor; $keyid=$navinfor['keyid']; $classid=$navinfor['classid']; $id=$navinfor['id']; $link_num=$class_r[$classid]['link_num']; if(!$link_num){ ret網站建設多少錢urn $fun_r['NotLinkNews']; } $tr=$empire->fetch1("select otherlinktemp,otherlinktempsub,otherlinktempdate from ".GetTemptb("enewspubtemp")." limit 1");網站seo優化 $temp_r=explode("[!--empirenews.listtemp--]",$tr[otherlinktemp]); if($keyid){ $add="id in (".$keyid.")"; }else{ $e=$id+$num; $s=$id-$num; $add=" classid=".$classid." and id>".$s." and id<".$e; } $key_sql=$empire->query("select id,newstime,title,isurl,titleurl,classid,titlepic from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where ".$add." order by newstime desc limit $link_num"); while($link_r=$empire->fetch($key_sql)){ if($link_r['id']==$id){ 如何seo優化推廣網站 continue; } $keyboardtext.=RepOtherTemp($temp_r[1],$link_r,$tr); } if(empty($keyboardtext)){ return $fun_r['NotLinkNews']; } $keyboardtext=$temp_r[0].$keyboardtext.$temp_r[2]; return $keyboardtext; }在模板中調用方法:<!--?=dp_getkeyboard(200)?-->
這個函數滿足我一個小站的功能,對于其它網站來說,補充調用信息可能比較簡陋,可以自行修改。
相關網站推廣優化seo網站優化seo培訓。聲明: 本文由我的SEOUC技術文章主頁發布于:2023-05-22 ,文章帝國CMS沒有相關信息時調用其它信息教程建站知主要講述時調,帝國,CMS網站建設源碼以及服務器配置搭建相關技術文章。轉載請保留鏈接: http://www.bifwcx.com/article/web_4935.html