php三元條件運算符:
<?=$bqr['ftitle']?$bqr['ftitle']:$bqr['title']?>
靈動或者php查詢調(diào)用編輯器內(nèi)容的時候要加stripslashes刪除反斜杠比如:
<?=stripslashes($r['newstext'])?>
內(nèi)容頁當(dāng)前信息ID:
$navinfor['id']
列表內(nèi)容模板信息ID:
$r['id']
當(dāng)前欄目名:
$class_r[$GLOBALS['navclassid']]['classname'];
當(dāng)前欄目父欄目:
$class_r[$GLOBALS['navclassid']]['bclassid'];
當(dāng)前欄目別名:
$class_r[$GLOBALS['navclassid']]['bname'];
當(dāng)前欄目子欄目:
$class_r[$GLOBALS['navclassid']]['sonclass'];
當(dāng)前欄目子判斷是否為終級欄目:
$class_r[$GLOBALS['navclassid']]['islast'];
當(dāng)前欄目是否有已審核信息:
$GLOBALS['num']==0為沒有信息
帝國cms中引入php路徑寫法(例子是文件在根目錄)
<?php include(ECMS_PATH."./bottom.php");?>
排除置頂、頭條,、推薦等,sql附加條件:
'istop=0 and isgood=0 and firsttitle=0'
上上級欄目id:
<?php $bclassid=$class_r[$GLOBALS[navclassid]][bclassid]; $bbclassid=$class_r[$bclassid][bclassid]; echo $bbclassid;?>
$bbclassid就是上上級父欄目id
投稿,、登陸、反饋、留言等之后跳轉(zhuǎn)指定頁面:
<input type=hidden name=ecmsfrom value="返回頁面地址">
統(tǒng)計信息被收藏數(shù):
<? $favas=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsfava where id='$navinfor[id]' and classid='$GLOBALS[navclassid]'");?>
<?=$favas?>就是這條信息的收藏數(shù)
列表,、結(jié)合項判斷當(dāng)前沒有信息給出提示:
<? if($GLOBALS['num']=='0'){ ?> <p>對不起,暫時沒有任何信息,!</p> <? }else{ ?> [!--empirenews.listtemp--]<!--list.var1-->[!--empirenews.listtemp--] <? }?>
動態(tài)使用:
網(wǎng)站名稱:
<?=$public_r['sitename']?>
網(wǎng)站地址:
<?=$public_r['newsurl']?>
帝國自身的時間轉(zhuǎn)換函數(shù):
<?=format_datetime($bqr[newstime],'Y-m-d')?>
此函數(shù)自帶判斷,,比較不錯,推薦,。
判斷內(nèi)容是否有圖片,,沒有圖片則顯示文中廣告 有圖片則不顯示:
<?php $string=$navinfor['newstext'];//內(nèi)容字段 $some="<img "; $num=explode($some,$string); if(count($num)>1){//判斷內(nèi)容中是否有圖片 ?> [!--newstext--] <? }else{ ?> <div id="ad">我抒告</div> [!--newstext--] <? }?>
截取加過濾標(biāo)簽:
<?=esub(htmlspecialchars(strip_tags($navinfor[newstext])),160)?>