最上面补充一个最重要的,如何快速在帝国论坛搜到自己要用的东西?请看下面(这里是万能之源)
百度站内搜索bbs.phome.net
获取栏目网址:
$classurl=sys_ReturnBqClassname($bqr,9);//取得栏目地址
判断是否首页(用于高亮):
<?=(!$GLOBALS[navclassid])?' class="cur"':''?>
判断是否当前页(高亮):
<?=($GLOBALS[navclassid]==$bqr[classid])?' class="cur"':''?>
各页面自动跳转移动端:
<script src="http://siteapp.baidu.com/static/webappservice/uaredirect.js" type="text/javascript"></script> <?php /*判断首页或者列表或者内页自动生成跳转地址,,,,,如果不生效就把百度这个js文件保存在网站本地*/ if(!$GLOBALS[navclassid]) { ?> <script type="text/javascript">uaredirect("http://m.xxx.com");</script> <?php } else { ?> <script type="text/javascript">uaredirect("http://m.xxx.com/<?=$class_r[$GLOBALS['navclassid']]['classpath']?>/<?=($navinfor[id]?$navinfor[id].'.html':'')?>");</script> <?php } ?>
还有另一种方式跳转7月19日更新:
<?php /*自动生成移动端跳转地址,仅限m.xxx.com形式,支持二级域名*/
$url = explode(".", $_SERVER['SERVER_NAME']); for ($i = 1; $i < sizeof($url); $i++) { $weburl.=".".$url[$i]; } if ($url[0]!="www"){ $weburl="http://".$url[0]."m".$weburl; } else{ $weburl="http://m".$weburl; } ?> <script type="text/javascript">uaredirect("<?=$weburl;?><?=$GLOBALS[navclassid]?'/':''?><?=$class_r[$GLOBALS['navclassid']]['classpath']?>/<?=($navinfor[id]?$navinfor[id].'.html':'')?>");</script>
按照指定排序调用SQL语句片段(配合条件调用):
order by field(classid,10,3,4,41,40)
栏目导航中判断某栏目是否为终极栏目:
if ($bqr[sonclass]=='' or $bqr[sonclass]=="|") ...
补充1: 判断当前栏目是否有设置标题分类并调用:
<?php //判断当前栏目是否有设置标题分类 $tr=$empire->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]){ ?> <div class="am-panel-bd" style=" padding:15px 5px; overflow:hidden;"> <? $ttids=explode(',',trim($tr[ttids],",")); foreach($ttids as $id){ $ttname_sql=sys_ReturnEcmsLoopBq("select * from [!db.pre!]enewsinfotype where typeid=$id",0,24,0); while($bqr2=$empire->fetch($ttname_sql)){ $tturl=sys_ReturnBqInfoTypeUrl($bqr2[typeid]); ?> <a class="ys4" href="<?=$tturl?>" target="_blank"><?=$bqr2[tname]?></a> <?php }//endwhile }//endfor ?> </div> <? }//ENDIF ?>
[2018.6.5]补充2:
禁止页面被复制和禁止右键:
<style type="text/css"> body { -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } </style> <script langauge="javascript"> document.oncontextmenu=function(e){return false;} </script> </head> ...
补充3: 访客留言或者新订单等等场景自动发邮件到管理员信箱: 并非原创,同时借鉴了轮胎两位大神的帖子,做了一些修改
//给管理员信箱发送通知邮件新增函数 20180523 //参考网址:http://bbs.phome.net/showthread-13-167022-0.html //参考网址:http://bbs.phome.net/ShowThread/?threadid=346659&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 .= "\r\n\r\n注意请勿直接回复邮件:\r\n客户信息及其留言信息全部在上面邮件内容中.\n\r"; $sm=EcmsToSendMail($pr['email'],'来自'.$siteurl.':'.$subject,$msgtext); return $sm; }
[2018.6.16]补充4:
[!--pagedes--]在内容页调用默认调用标题的无损解法: 通常大家可能会去修改functions.php,对以后升级会存在影响. 为了SEO想了一个折中简单的办法.
<meta name="description" content="<?=$navinfor[id]?$navinfor[smalltext].'---':''?>[!--pagedes--]" />
帖子内容容量受限,19日更新到33楼 帖子内容容量受限,23日更新到33楼 帖子内容容量受限,7月9日更新到33楼 帖子内容容量受限,7月19日更新到33楼
http://bbs.phome.net/showthread-42-358601-3.html
|