织梦一级目录作域名list.php无法跳转到手机站解决方法

相关案例演示

最近测试了www.dede58.com/m/list.php?tid=1  在手机站访问的时候,无法跳转到手机的模板,终于找到了解决了方法,给大家分享一下

修改根目录下的m/list.php文件

 

重新弄的代码, 不区分几级目录,理论是根据你指定的PC,重新指定手机的模板 (也就是说,直接用这个代替现有的文件,就可以实现几级访问都行了

复制以下代码替换list.php即可

<?php
/**
 *
 * 栏目列表/频道动态页
 *
 * @version        $Id: list.php 1 15:38 2010年7月8日Z tianya $
 * @package        DedeCMS.Site
 * @copyright      Copyright (c) 2007 - 2010, DesDev, Inc.
 * @license        http://help.dedecms.com/usersguide/license.html
 * @link           http://www.dedecms.com
 */
define('DEDEMOB', 'Y');
require_once(dirname(__FILE__)."/../include/common.inc.php");


//$t1 = ExecTime();


$tid = (isset($tid) && is_numeric($tid) ? $tid : 0);


$channelid = (isset($channelid) && is_numeric($channelid) ? $channelid : 0);


if($tid==0 && $channelid==0) die(" Request Error! ");
if(isset($TotalResult)) $TotalResult = intval(preg_replace("/[^\d]/", '', $TotalResult));




//如果指定了内容模型ID但没有指定栏目ID,那么自动获得为这个内容模型的第一个顶级栏目作为频道默认栏目
if(!empty($channelid) && empty($tid))
{
    $tinfos = $dsql->GetOne("SELECT tp.id,ch.issystem FROM `dede_arctype` tp LEFT 
    JOIN `dede_channeltype` ch ON ch.id=tp.channeltype WHERE tp.channeltype='$channelid' And tp.reid=0 order by sortrank asc");
    if(!is_array($tinfos)) die(" No catalogs in the channel! ");
    $tid = $tinfos['id'];
}
else
{
    $tinfos = $dsql->GetOne("SELECT ch.issystem FROM `dede_arctype` tp LEFT JOIN `dede_channeltype` ch 
    ON ch.id=tp.channeltype WHERE tp.id='$tid' ");
}


if($tinfos['issystem']==-1)
{
    $nativeplace = ( (empty($nativeplace) || !is_numeric($nativeplace)) ? 0 : $nativeplace );
    $infotype = ( (empty($infotype) || !is_numeric($infotype)) ? 0 : $infotype );
    if(!empty($keyword)) $keyword = FilterSearch($keyword);
    $cArr = array();
    if(!empty($nativeplace)) $cArr['nativeplace'] = $nativeplace;
    if(!empty($infotype)) $cArr['infotype'] = $infotype;
    if(!empty($keyword)) $cArr['keyword'] = $keyword;
    include(DEDEINC."/arc.sglistview.class.php");
    $lv = new SgListView($tid,$cArr);
} else {
    include(DEDEINC."/arc.listview.class.php");
    $lv = new ListView($tid);


    $ispart=$lv->Fields['ispart'];
    if($ispart==1){
    $tpl=$lv->Fields['tempindex'];
   $tpl=str_replace('.htm','_m.htm',$tpl);
   $lv->Fields['tempindex']=$tpl;
   $lv->TypeLink->TypeInfos['tempindex']=$tpl;
    }else{
    $tpl=$lv->Fields['templist'];
   $tpl=str_replace('.htm','_m.htm',$tpl);
   $lv->Fields['templist']=$tpl;
   $lv->TypeLink->TypeInfos['templist']=$tpl;
    }






    // print_r($lv);
    // exit();
    


    //对设置了会员级别的栏目进行处理
    if(isset($lv->Fields['corank']) && $lv->Fields['corank'] > 0)
    {
        require_once(DEDEINC.'/memberlogin.class.php');
        $cfg_ml = new MemberLogin();
        if( $cfg_ml->M_Rank < $lv->Fields['corank'] )
        {
            $dsql->Execute('me' , "SELECT * FROM `dede_arcrank` ");
            while($row = $dsql->GetObject('me'))
            {
                $memberTypes[$row->rank] = $row->membername;
            }
            $memberTypes[0] = "游客或没权限会员";
            $msgtitle = "你没有权限浏览栏目:{$lv->Fields['typename']} !";
            $moremsg = "这个栏目需要 <font color='red'>".$memberTypes[$lv->Fields['corank']]."</font> 才能访问,
            你目前是:<font color='red'>".$memberTypes[$cfg_ml->M_Rank]."</font> !";
            include_once(DEDETEMPLATE.'/plus/view_msg_catalog.htm');
            exit();
        }
    }
}




if($lv->IsError) ParamError();


$lv->Display();

免责声明:本站所有文章和图片均来自用户分享和网络收集,文章和图片版权归原作者及原出处所有,仅供学习与参考,请勿用于商业用途,如果损害了您的权利,请联系网站客服处理。


来源:网友投稿 关注: 时间:2018-07-16 17:35
首先声明,只要是我们的vip会员所有源码均可以免费下载,不做任何限制(了解更多)
☉本站的源码不会像其它下载站一样植入大量的广告。为了更好的用户体验以后坚持不打水印
☉本站只提供精品织梦源码,源码在于可用,不在多!!希望在这里找到你合适的。
☉本站提供的整站织梦程序,均带数据及演示地址。可以在任一源码详情页查看演示地址
☉本站所有资源(包括源码、模板、素材、特效等)仅供学习与参考,请勿用于商业用途。
☉如有其他问题,请加网站客服QQ进行交流。
相关织梦教程
QQ在线咨询