
列表页中单个产品显示所属专题,增加到列表内容模板(list.var)中:
来源:
浏览:122
时间:2023-08-15
大鸟还是很喜欢用帝国来建站的,我们建站新手一般都是从织梦开始,但是织梦永久了,发现还是帝国cms不错,织梦都是用来练手,帝国说实话还是复杂很多的。大鸟平时用的帝国代码收录下来记录在这里,自己用到的时候刚好也可以查阅。
$classurl=sys_ReturnBqClassname($bqr,9);//取得栏目地址
判断是否首页(用于高亮):
=(!$GLOBALS[navclassid])?' class="cur"':''?>
判断是否当前页(高亮):
=($GLOBALS[navclassid]==$bqr[classid])?' class="cur"':''?>
各页面自动跳转移动端:
按照指定排序调用SQL语句片段(配合条件调用):
order by field(classid,10,3,4,41,40)
栏目导航中判断某栏目是否为终极栏目:
if ($bqr[sonclass]=='' or $bqr[sonclass]=="|") ...
补充1:判断当前栏目是否有设置标题分类并调用:
fetch1("select ttids from phome_enewsclassadd where classid=$GLOBALS[navclassid]");
//上面这句如果用在标题分类列表页需要改为$tr=$empire->fetch1('select ttids from phome_enewsclassadd where ttids like "%'.$GLOBALS[navclassid].'%"');
if ($tr[ttids]){
?>
}//ENDIF
?>
补充2:禁止页面被复制和禁止右键:
...
补充3:访客留言或者新订单等等场景自动发邮件到管理员信箱:
并非原创,同时借鉴了轮胎两位大神的帖子,做了一些修改。
//给管理员信箱发送通知邮件新增函数 20180523
//参考网址:
//参考网址:;forumid=13
function SendNoticeToAdmin($siteurl,$body){
global $empire,$dbtbpre;
$empire=new mysqlquery();
$pr=$empire->fetch1("select email from {$dbtbpre}enewspublic limit 1");
if(is_array($body)){
foreach($body as $value){
$key=key($body);
next($body);
//过滤和替换邮件里显示的内容 自修改
if ($key=='name' or $key=='mycall' or $key=='lytext' or $key=='ecmsfrom'){
switch ($key){
case 'name':
$key="留言者";
$subject=$value;
break;
case 'mycall':
$key="联系方式";
$subject.="(".$value.")的留言";
break;
case 'lytext':
$key="留言内容";
break;
case 'ecmsfrom':
$key="来源网址";
$value= $siteurl.$value;//此处修改网站首页前缀
break;
}
$msgtext .= "[$key]:"."$value"."n";
}
}
}else{
$msgtext=$body;
}
//$msgtext .= "rnrn注意请勿直接回复邮件:rn客户信息及其留言信息全部在上面邮件内容中.nr";
$sm=EcmsToSendMail($pr['email'],'来自'.$siteurl.':'.$subject,$msgtext);
return $sm;
}
补充4:
[!–pagedes–]在内容页调用默认调用标题的无损解法:通常大家可能会去修改functions.php,对以后升级会存在影响. 为了SEO想了一个折中简单的办法.
补充5:专题列表页调用同classid其他专题,输出导航和高亮:
fetch($ecms_bq_sql)) { $ecms_bq_sql2=sys_ReturnEcmsLoopBq('select ztid,ztname,ztpath,ztimg from phome_enewszt where classid='.$bqr[classid],8,24,0,'','ztid asc'); $bqno2=0; while($bqr2=$empire->fetch($ecms_bq_sql2)) { $bqno2++; ?> >=esub($bqr2[ztname],15)?> }//endwhile2 }//endwhile1 ?>
列表页中单个产品显示所属专题,增加到列表内容模板(list.var)中:
$ecms_bq_sql=sys_ReturnEcmsLoopBq('select ztid from phome_enewsztinfo where id='.$r[id],1,24,0,'','');
while($bqr=$empire->fetch($ecms_bq_sql))
{
$ecms_bq_sql2=sys_ReturnEcmsLoopBq('select ztid,ztname,ztpath,ztimg from phome_enewszt where ztid='.$bqr[ztid],1,24,0,'','');
while($bqr2=$empire->fetch($ecms_bq_sql2))
{
$zturl=$public_r[newsurl].$bqr2[ztpath];
$ztname=$bqr2[ztname];
}//endwhile2
}//endwhile1
循环调用产品栏目数据,替代循环子栏目信息标签,可自由更改模版和调用条件:
[e:loop={'select classid,classname,classpath from phome_enewsclass where bclassid=1 and showclass=0 order by classid asc',10,24,0,'',''}]
$classurl=sys_ReturnBqClassname($bqr,9);//取得栏目地址
?>
=$bqr[classname]?>
query("select title,titlepic,titleurl from phome_ecms_newmaterial where classid = '".$bqr[classid]."' order by newstime desc");
//取得该分类下的最新数据
while($r=$empire->fetch($pro_new)) {
$url=sys_ReturnBqTitleLink($r);
?>
=$r[title]?>
[/e:loop]
全站SEO标题懒人格式:
“网页标题”+”文章内页优化用自定义字段”或者”栏目或专题页优化用自定字段”+网站名称(首页不显示)
[!--pagetitle--]=$navinfor[id]?'/'.$navinfor[tuijie]:''//如果在文章内页显示自定义字段tuijie内容?>=($GLOBALS[navclassid] and !$navinfor[id])?'/'.ReturnClassAddField($GLOBALS[navclassid],'tuijie').ReturnZtAddField($GLOBALS[navclassid],'tuijie'):''//如果在栏目内页显示自定义字段tuijie内容,专题自定义字段函数并列一起但不会同时调用?>=$GLOBALS[navclassid]?'/'.$public_r[sitename]:''//如果在不在首页显示后台设置的网站标题?>
多访问端换域名后必须执行的SQL语句(全):
update phome_ecms_news_data_1 set newstext=REPLACE(newstext,'老域名','新域名'); update phome_ecms_news set titlepic=REPLACE(titlepic,'老域名','新域名'); update phome_ecms_newmaterial set newstext=REPLACE(newstext,'老域名','新域名'),titlepic=REPLACE(titlepic,'老域名','新域名'); update phome_enewsclass set classimg=REPLACE(classimg,'老域名','新域名'); update phome_enewsclassadd set eclasspagetext=REPLACE(eclasspagetext,'老域名','新域名'); update phome_enewspublic set fileurl=REPLACE(fileurl,'老域名','新域名'); update phome_enewsmoreport set purl=REPLACE(purl,'m.老域名','m.新域名');
都是平时自己会用到的,上不了什么台面,也是为了方便自己查阅,肯定还有很多其他的,大鸟会陆续分享,如果你也有很好用的代码,不放跟大鸟分享。


