SeaCMS获取当前页面URL以使用Meta标签移动适配
编辑 /include/mkhtml.func.php
文件,找到:
function makePlayByData($vType,$vId,$playArr,$content,$sdate,$enname,$stringecho)
{
if($GLOBALS['cfg_ismakeplay']==1){
for($i=0;$i<$playArr[0];$i++)
{
$tmp =$content;
$tmp = str_replace("{playpage:from}",$playArr[1][$i],$tmp);
foreach ($playArr[2][$i] as $n=>$play){
$tmp1 =$tmp;
$playLink = str_replace($GLOBALS['cfg_cmspath'],"",getPlayLink2($vType,$vId,$sdate,$enname,$i,$n));
$tmp1 = str_replace("{playpage:part}",$play,$tmp1);
在下方插入:
$tmp1 = str_replace("{currentpageurl}",'http://'.$_SERVER['HTTP_HOST'].$playLink,$tmp1);
找到:
if($TotalResult == 0||strpos($content,'{/seacms:channellist}')===false){
$channelLink=str_replace($GLOBALS['cfg_cmspath'],"",getChannelPagesLink($currentTypeId,1));
$tempStr = str_replace("{channelpage:page}",1,$tempStr);
$content=$tempStr;
$content=$mainClassObj->ParsePageList($content,$typeIds,1,$pCount,$TotalResult,"channel",$currentTypeId);
$content=$mainClassObj->parseIf($content);
在下方插入:
$content=str_replace("{currentpageurl}",'http://'.$_SERVER['HTTP_HOST'].$channelLink,$content);
找到
for($i=$mstart;$i<=$mend;$i++){
$tmp=$content;
$channelLink=str_replace($GLOBALS['cfg_cmspath'],"",getChannelPagesLink($currentTypeId,$i));
$tmp = str_replace("{channelpage:page}",$i,$tmp);
$tmp=$mainClassObj->ParsePageList($tmp,$typeIds,$i,$pCount,$TotalResult,"channel",$currentTypeId);
$tmp=$mainClassObj->parseIf($tmp);
在下方插入:
$tmp=str_replace("{currentpageurl}",'http://'.$_SERVER['HTTP_HOST'].$channelLink,$tmp);
找到:
for($i=1;$i<=$pCount;$i++){
if ($i>=$startpage && $i<=$endpage){
$tempStr2 = str_replace("{channelpage:page}",$i,$tempStr);
$channelLink=str_replace($GLOBALS['cfg_cmspath'],"",getChannelPagesLink($currentTypeId,$i));
$content=$tempStr2;
$content=$mainClassObj->ParsePageList($content,$typeIds,$i,$pCount,$TotalResult,"channel",$currentTypeId);
$content=$mainClassObj->parseIf($content);
在下方插入:
$content=str_replace("{currentpageurl}",'http://'.$_SERVER['HTTP_HOST'].$channelLink,$content);
Meta标签移动适配置:
<meta name="mobile-agent" content="format=html5;url={currentpageurl}" />