帝国cms笔记
1.侧边栏或导航部分 点击出现样式
[e:loop={"select classid, classname, classpath from `[!db.pre!]enewsclass` where bclassid='8' order by `classid` asc ",5,24,0,0,0}]
<li
<?php
if($bqr[classid]==$GLOBALS[navclassid])//当前栏⽬ID
{
echo "class= 'cur'";
}
>><a href="[!--news.url--]<=$class_r[$bqr[classid]]['classpath']>/" > <=$class_r[$bqr[classid]]['classname']></a></li> [/e:loop]
2.列表页获取⽂章标题,图⽚
[!--empirenews.listtemp--]
<!--list.var1-->
<!--list.var2-->
<!--list.var3-->
<!--list.var4-->
<!--list.var5-->
[!--empirenews.listtemp--]
<li>
<div class="img"><a href="[!--titleurl--]"><img src="[!--titlepic--]" width="250" height="148"></a></div>
<h2><a href="[!--titleurl--]">[!--title--]</a></h2>
<p>项⽬位于资阳市雁江区城东新区⾏政商务核⼼,西与雁江区政府为邻,北瞰资阳最⼤森林公园字</p>
<a href="[!--titleurl--]" class="more"><img src="[!--news.url--]skin/style/images/more3.png"></a>
</li>
3.列表页获取⽂字内容
$fr=$empire->fetch1("select newstext from {$dbtbpre}ecms_news_data_{$r[stb]} where id='$r[id]'");
$listtemp=''.$fr[newstext].'';
4.表单提交跳转地址
<input type="hidden" name="ecmsfrom" value="[!--news.url--]">
5.⾸页添加友情链接
[e:loop={'select lname,lurl,lpic from [!db.pre!]enewslink where checked=1 order by myorderlimit 0,6',20,24,0}]
<li><a href="<?=$bqr[lurl]?>" target="_blank" ><?=$bqr[lname]?></a></li>
[/e:loop]
6.多图上传 字段名为morepic 存在副表
<?php
$str=$navinfor[morepic];
$exp=explode("\\r\\n",$str);
$exp1=explode("::::::",$exp[0]);
$exp2=explode("::::::",$exp[1]);
$exp3=explode("::::::",$exp[2]);
$exp4=explode("::::::",$exp[3]);
>
<li><img src=" <?=$exp1[0]?>"> </li>
<li><img src=" <?=$exp2[0]?>"> </li>
<li><img src=" <?=$exp3[0]?>"> </li>
<li><img src=" <?=$exp4[0]?>"> </li>
7.列表页获取当前栏⽬链接
列表页获取当前栏⽬链接 : <?=sys_ReturnBqClassUrl($class_r[$GLOBALS[navclassid]]);?>
列表页获取当前栏⽬名称 :[!--class.name--]
8.验证码
登陆点击刷新验证码
<input name="key" type="text" size="10" /> <img src="../../ShowKey/?v=login" align="absmiddle"
onClick="this.src='../../ShowKey/?v=login&'+Math.random();" alt="点击刷新图⽚" />
注册点击刷新验证码
<input name="key" type="text" size="10" />
<img src="../../ShowKey/?v=reg" align="absmiddle" onClick="this.src='../../ShowKey/?v=reg&'+Math.random();" alt="点击刷新图⽚" />
留⾔点击刷新验证码
<input type=text name=key size=6 ><img src="/e/ShowKey/?v=gbook" align="middle" onClick="this.src='/e/ShowKey/?
v=gbook&'+Math.random();" alt="点击刷新图⽚" />
反馈点击刷新验证码
<input type=text name=key size=6 ><img src="/av/e/ShowKey/?v=feedback" align="middle"
onClick="this.src='/av/e/ShowKey/?v=feedback&'+Math.random();" alt="看不清楚,点击刷新" />
9.判断是⼿机还是pc
<script>
if ((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iOS|iPad|Backerry|WebOS|Symbian|Windows
Phone|Phone)/i))) {
window.location.href = "gcj.whyh100/e/wap";
}else{
}
</script>
10.简述去除HTML标记
function NoHTML($string){
$string = preg_replace("'<script[^>]*?>.*?</script>'si", "", $string);//去掉javascript
$string = preg_replace("'<[\/\!]*?[^<>]*?>'si", "", $string);        //去掉HTML标记
$string = preg_replace("'([\r\n])[\s]+'", "", $string);              //去掉空⽩字符
$string = preg_replace("'&(quot|#34);'i", "", $string);              //替换HTML实体
$string = preg_replace("'&(amp|#38);'i", "", $string);
$string = preg_replace("'&(lt|#60);'i", "", $string);
$string = preg_replace("'&(gt|#62);'i", "", $string);
$string = preg_replace("'&(nbsp|#160);'i", "", $string);
$string = preg_replace("'&(middot|#183);'i", "", $string);
return $string;
}
11.特殊字符处理
帝国cms文库模板<?php echo mb_convert_encoding("2017 ", "GBK","UTF-8") ;?>
12.⾸页添加news
[e:loop={9,8,0,0,'','newstime DESC'}]
<dt><span>[<?=date('Y-m-d',$bqr[newstime])?>]</span><a href="<?=$bqsr['titleurl']?>" target="_blank"><?
=esub($bqr[title],20)?></a></dt>
[/e:loop]
[e:loop={13,7,0,0,'','newstime DESC'}]
<li class="clearfix"><b>[<?=date('Y-m-d',$bqr[newstime])?>]</b><a href="<?=$bqsr['titleurl']?>" target="_blank"><?
=esub($bqr[title],32,'…')?></a></li>
[/e:loop]
[e:loop={8,3,0,1,'','newstime DESC'}]
<li><a href="<?=$bqsr['titleurl']?>" target="_blank"><h3><?=esub($bqr[title],30)?> </h3><img src="<?=$bqr[titlepic]?>" width="347" height="351"  > </a></li>
[/e:loop]
[e:loop={18,1,0,1,'','newstime DESC'}]
<div id="myTab1_Content0"><div class="tabimg"><a href="<?=$bqsr['titleurl']?>" target="_blank"><img src="$bqr[titlepic]" width="1058" height="562"><p><?=esub($bqr[title],20)?></p></a></div></div>
[/e:loop]
12.表单搜索
<form action="/e/search/index.php" method="post" name="search_news" id="searchform">
<input type="hidden" name="show" value="title,casno,mf,mw,source,productid" />
<input type="hidden" name="tempid" value="1" />
<input type="hidden" name="tbname" value="news" />
<input type="hidden" name="classid" value="3">
<table border="0" cellspacing="6" cellpadding="0">
<tr>
<td>
<input placeholder="search" name="keyboard" type="text" id="keyboard" class="inputText"
style='width:500px;height:26px;position:relative;top:-2px;padding-left:5px;z-index:9999;' />
</td>
<td><input type="image" class="inputSub" src="/images/search_button.gif" style='position:relative;left:-
31px;height:16px;width:16px;top:-2px;z-index:9999;' />
</td>
</tr>
</table>
</form>