dede织梦系统栏目页同时生成wap手机版的html页

 时间:2024-10-22 05:20:51

1、首先创建手机版的栏目模板,这里自己创建,跟其他模板一样,不过保存路径/templets/wap/list_article.htm,详情看前面文章介绍

dede织梦系统栏目页同时生成wap手机版的html页

2、首先找到include目录下的arc.listview.class.php,修改文件前最好备份一下,找到function CountRecord给函数加一个参数修改成function CountRecord($iswap=0)并在函数中if(!file_exists($tempfile))前加入代码if($iswap==1){ $tempfile = str_replace('/'.$GLOBALS['cfg_df_style'].'/','/wap/',$tempfile); }

dede织梦系统栏目页同时生成wap手机版的html页
dede织梦系统栏目页同时生成wap手机版的html页

3、找到函数function MakeHtml($startpage=1, $makepagesize=0, $isremote=0)把最后面 return $murl;修改成$reurl=$murl; $this->MakeWapHtml($startpage, $makepagesize, $isremote); return $reurl;

dede织梦系统栏目页同时生成wap手机版的html页

4、添加函数MakeWapHtml代码如下function MakeWapHtml($startpage=1, $makepagesize=0, $isremote=0) { global $cfg_remote_site; if(empty($startpage)) { $startpage = 1; } //创建封面模板文件 if($this->TypeLink->TypeInfos['isdefault']==-1) { echo '这个类目是动态类目!'; // return '../plus/list.php?tid='.$this->TypeLink->TypeInfos['id']; } //单独页面 else if($this->TypeLink->TypeInfos['ispart']>0) { $reurl = $this->MakePartTemplets(); // return $reurl; } $this->CountRecord(1); //初步给固定值的标记赋值 $this->ParseTempletsFirst(); $totalpage = ceil($this->TotalResult/$this->PageSize); if($totalpage==0) { $totalpage = 1; } CreateDir(MfTypedir($this->Fields['typedir'])); $murl = ''; if($makepagesize > 0) { $endpage = $startpage+$makepagesize; } else { $endpage = ($totalpage+1); } if( $endpage >= $totalpage+1 ) { $endpage = $totalpage+1; } if($endpage==1) { $endpage = 2; } for($this->PageNo=$startpage; $this->PageNo < $endpage; $this->PageNo++) { $this->ParseDMFields($this->PageNo,1); $makeFile = $this->GetMakeFileRule($this->Fields['id'],'list',$this->Fields['typedir'],'',$this->Fields['namerule2']); $makeFile = str_replace("{page}", $this->PageNo, $makeFile); $murl = $makeFile; if(!preg_match("/^\//", $makeFile)) { $makeFile = "/".$makeFile; } $makeFile = $this->GetTruePath().$makeFile; $makeFile = preg_replace("/\/{1,}/", "/", $makeFile); $makeFile=str_replace('/html/','/wap/',$makeFile); $murl = $this->GetTrueUrl($murl); if(!is_dir(dirname($makeFile))) { mkdir(dirname($makeFile), 0777, true); } $this->dtp->SaveTo($makeFile); //如果启用远程发布则需要进行判断 if($cfg_remote_site=='Y'&& $isremote == 1) { //分析远程文件路径 $remotefile = str_replace(DEDEROOT, '',$makeFile); $localfile = '..'.$remotefile; $remotedir = preg_replace('/[^\/]*\.html/', '',$remotefile); //不相等则说明已经切换目录则可以创建镜像 $this->ftp->rmkdir($remotedir); $this->ftp->upload($localfile, $remotefile, 'acii'); } } if($startpage==1) { //如果列表启用封面文件,复制这个文件第一页 if($this->TypeLink->TypeInfos['isdefault']==1 && $this->TypeLink->TypeInfos['ispart']==0) { $onlyrule = $this->GetMakeFileRule($this->Fields['id'],"list",$this->Fields['typedir'],'',$this->Fields['namerule2']); $onlyrule = str_replace("{page}","1",$onlyrule); $list_1 = $this->GetTruePath().$onlyrule;$list_1=str_replace('/html/','/wap/',$list_1); $murl = MfTypedir($this->Fields['typedir']).'/'.$this->Fields['defaultname']; //如果启用远程发布则需要进行判断 if($cfg_remote_site=='Y'&& $isremote == 1) { //分析远程文件路径 $remotefile = $murl; $localfile = '..'.$remotefile; $remotedir = preg_replace('/[^\/]*\.html/', '',$remotefile); //不相等则说明已经切换目录则可以创建镜像 $this->ftp->rmkdir($remotedir); $this->ftp->upload($localfile, $remotefile, 'acii'); } $indexname = $this->GetTruePath().$murl; $indexname=str_replace('/html/','/wap/',$indexname); copy($list_1,$indexname); } } }

dede织梦系统栏目页同时生成wap手机版的html页

5、找到函数function MakePartTemplets()修改最后面的代码return $this->GetTrueUrl($makeUrl);修改成$returl=$this->GetTrueUrl($makeUrl); $this->MakeWapPartTemplets(); return $returl;

dede织梦系统栏目页同时生成wap手机版的html页

6、添加函数function MakeWapPartTemplets()代码如下function MakeWapPartTemplets() { $this->PartView = new PartView($this->TypeID,false); $this->PartView->SetTypeLink($this->TypeLink); $nmfa = 0; $tmpdir = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir'].'/wap'; if($this->Fields['ispart']==1) { $tempfile = str_replace("{tid}",$this->TypeID,$this->Fields['tempindex']); $tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile); $tempfile = $tmpdir."/".$tempfile; $tempfile=str_replace('/wap/'.$GLOBALS['cfg_df_style'].'/','/wap/',$tempfile); if(!file_exists($tempfile)) { $tempfile = $tmpdir."/".$GLOBALS['cfg_df_style']."/index_default.htm"; } $this->PartView->SetTemplet($tempfile); } else if($this->Fields['ispart']==2) { //跳转网址 // return $this->Fields['typedir']; } CreateDir(MfTypedir($this->Fields['typedir'])); $makeUrl = $this->GetMakeFileRule($this->Fields['id'],"index",MfTypedir($this->Fields['typedir']),$this->Fields['defaultname'],$this->Fields['namerule2']); $makeUrl = preg_replace("/\/{1,}/", "/", $makeUrl); $makeFile = $this->GetTruePath().$makeUrl; $makeFile=str_replace('/html/','/wap/',$makeFile); if($nmfa==0) { if(!is_dir(dirname($makeFile))) { mkdir(dirname($makeFile), 0777, true); } $this->PartView->SaveToHtml($makeFile); //如果启用远程发布则需要进行判断 if($GLOBALS['cfg_remote_site']=='Y'&& $isremote == 1) { //分析远程文件路径 $remotefile = str_replace(DEDEROOT, '',$makeFile); $localfile = '..'.$remotefile; $remotedir = preg_replace('/[^\/]*\.html/', '',$remotefile); //不相等则说明已经切换目录则可以创建镜像 $this->ftp->rmkdir($remotedir); $this->ftp->upload($localfile, $remotefile, 'acii'); } } else { if(!file_exists($makeFile)) { $this->PartView->SaveToHtml($makeFile); //如果启用远程发布则需要进行判断 if($cfg_remote_site=='Y'&& $isremote == 1) { //分析远程文件路径 $remotefile = str_replace(DEDEROOT, '',$makeFile); $localfile = '..'.$remotefile; $remotedir = preg_replace('/[^\/]*\.html/', '',$remotefile); //不相等则说明已经切换目录则可以创建镜像 $this->ftp->rmkdir($remotedir); $this->ftp->upload($localfile, $remotefile, 'acii'); } } } }

dede织梦系统栏目页同时生成wap手机版的html页
  • 火车头采集器将HTML转为UBB发布到Discuz的方法
  • LOLS7寡妇制造者伊芙琳打野出装天赋符文加点
  • 短信平台使用注意事项
  • lols6战争之影赫卡里姆人马上单天赋符文加点图
  • 全民飞机大战新战机路西法属性介绍
  • 热门搜索
    端午节手抄报图片大全 小学生手抄报图片大全 语文手抄报 反对邪教手抄报 校园安全手抄报 春节的手抄报 读书的手抄报 端午手抄报 心理健康手抄报内容 小学生安全手抄报