SeaCMS播放页if判断无效的解决方法

常用判断(用于显示当前播放来源):

{playpage:playlist}<dd id="[playlist:ename]"{if:'{playpage:from}'<>'[playlist:from]'} style="display: none;"{else} style="display: block;"{end if}><p>资源来自<strong>[playlist:from]</strong>,[playlist:intro]</p><ul>[playlist:link]</ul></dd>{/playpage:playlist}

{playpage:playlist}{if:{playpage:from}==[playlist:from]}'#[playlist:ename]'{end if}{/playpage:playlist}

但上面的判断在最新版本,即6.46版中无效。

解决方法:

编辑 /include/mkhtml.func.php 文件,找到第573行,将

$content=$mainClassObj->parseIf($content);
$playArr = playData2Ary($row['v_playdata']);
makePlayByData($vType,$vId,$playArr,$content,date('Y-n',$row['v_addtime']),$row['v_enname'],$stringecho);

修改为

//$content=$mainClassObj->parseIf($content);
$playArr = playData2Ary($row['v_playdata']);
makePlayByData($vType,$vId,$playArr,$content,date('Y-n',$row['v_addtime']),$row['v_enname'],$stringecho);

找到第583行,将:

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);
                createTextFile($tmp1,sea_ROOT.$playLink,"");
                $stringecho .= echoEach($play, $i, '..'.$playLink, "play");
            }
        }
    }else{
        $content = str_replace("{playpage:part}","",$content);
        $content = str_replace("{playpage:from}","",$content);
        $playLink = str_replace($GLOBALS['cfg_cmspath'],"",getPlayLink2($vType,$vId,$sdate,$enname));
        createTextFile($content,sea_ROOT.$playLink,"");
    }
    
}

修改为:

function makePlayByData($vType,$vId,$playArr,$content,$sdate,$enname,$stringecho)
{
    global $mainClassObj;
    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=$mainClassObj->parseIf($tmp1);
                createTextFile($tmp1,sea_ROOT.$playLink,"");
                $stringecho .= echoEach($play, $i, '..'.$playLink, "play");
            }
        }
    }else{
        $content = str_replace("{playpage:part}","",$content);
        $content = str_replace("{playpage:from}","",$content);
        $playLink = str_replace($GLOBALS['cfg_cmspath'],"",getPlayLink2($vType,$vId,$sdate,$enname));
        $content=$mainClassObj->parseIf($content);
        createTextFile($content,sea_ROOT.$playLink,"");
    }
    
}

标签:方法, seacms, 播放, 判断

添加新评论