dedecms织梦系统生成wap手机版静态页完整版,需要使用特定的插件或模板,并进行相应的配置。
在Dedecms织梦系统中生成wap手机版静态页的完整版操作包括以下几个步骤:
1、配置基础环境:打开include目录下的common.inc.php文件,在第26行加入代码定义手机版静态页目录和模板目录路径,具体如下:
   define('DEDEWAPPATH','/wap'); //生成手机版静态页目录   define('DEDEWAPTEMPLATESPATH','/wap/'); //手机版模板目录templets2、创建手机版文章模板:在templets目录下创建wap文件夹,并在其中创建文章模板文件article_article.htm,保存路径为/templets/wap/article_article.htm。
3、修改arc.archives.class.php文件:找到include目录下的arc.archives.class.php文件,并备份原文件以防万一,然后找到函数MakeHtml($isremote=0),在438行进行修改:
$returl=$this>GetTrueUrl($filename); $this>MakeWapHtml($isremote); return $returl;
在442行增加函数代码:
   function MakeWapHtml($isremote=0){       global $cfg_df_style,$cfg_arcdir;       $tempfile = $this>GetTempletFile();       $tempfile = str_replace('/' . $cfg_df_style . '/',DEDEWAPTEMPLATESPATH,$tempfile);       if(!file_exists($tempfile) || !is_file($tempfile)){           //处理不存在或非文件的情况       }else{           global $cfg_remote_site,$fileFirst;           if($this>IsError){               return '';           }           $this>Fields["displaytype"] = "st";           //预编译$th           $this>dtp>LoadTemplate($tempfile);           $this>TempSource = $this>dtp>SourceString;           $this>ParAddTable();           $this>ParseTempletsFirst();           $this>Fields['senddate'] = empty($this>Fields['senddate'])? '' : $this>Fields['senddate'];           $this>Fields['title'] = empty($this>Fields['title'])? '' : $this>Fields['title'];           $this>Fields['arcrank'] = empty($this>Fields['arcrank'])? 0 : $this>Fields['arcrank'];           $this>Fields['ismake'] = empty($this>Fields['ismake'])? 0 : $this>Fields['ismake'];           $this>Fields['money'] = empty($this>Fields['money'])? 0 : $this>Fields['money'];           $this>Fields['filename'] = empty($this>Fields['filename'])? '' : $this>Fields['filename'];           //分析要创建的文件名称           $filename = GetFileNewName(               $this>ArcID,$this>Fields['typeid'],$this>Fields['senddate'],               $this>Fields['title'],$this>Fields['ismake'],$this>Fields['arcrank'],               $this>TypeLink>TypeInfos['namerule'],$this>TypeLink>TypeInfos['typedir'],$this>Fields['money'],$this>Fields['filename']           );           $filename=str_replace($cfg_arcdir .'/',DEDEWAPPATH .'/',$filename);           $filenames = explode(".", $filename);           $this>ShortName = $filenames[count($filenames)1];           if($this>ShortName=='') $this>ShortName = 'html';           $fileFirst = preg_replace("/.".$this>ShortName."$/i", "", $filename);           $this>Fields['namehand'] = basename($fileFirst);           $filenames = explode("/", $filename);           $this>NameFirst = preg_replace("/.".$this>ShortName."$/i", "", $filenames[count($filenames)1]);           if($this>NameFirst=='')               $this>NameFirst = $this>arcID;           //获得当前文档的全名           $filenameFull = GetFileUrl(               $this>ArcID,$this>Fields['typeid'],$this>Fields["senddate"],               $this>Fields["title"],$this>Fields["ismake"],               $this>Fields["arcrank"],$this>TypeLink>TypeInfos['namerule'],$this>TypeLink>TypeInfos['typedir'],$this>Fields["money"],$this>Fields['filename'],               $this>TypeLink>TypeInfos['moresite'],$this>TypeLink>TypeInfos['siteurl'],$this>TypeLink>TypeInfos['sitepath']           );           $this>Fields['arcurl'] = $this>Fields['fullname'] = $filenameFull;           //对于已设置不生成HTML的文章直接返回网址           if($this>Fields['ismake']==1 || $this>Fields['arcrank']!=0 || $this>Fields['money']>0 || ($this>Fields['isma'] && $this>TypeLink>TypeInfos['ismove'])){               return $filenameFull;           }       }   }4、更新WAP主页、栏目和文档:复制dede/makehtml_homepage.php文件并重命名为makehtml_homepagewap.php,修改最后一行以包含WAP主页模板;复制dede/makehtml_list.php文件并重命名为makehtml_listwap.php,修改最后一行以包含WAP栏目模板;复制dede/makehtml_archives.php文件并重命名为makehtml_archiveswap.php,修改最后一行以包含WAP文档模板。
5、更新后台导航链接:打开dede/inc/inc_menu.php文件,在146行下面添加代码以添加后台导航栏目链接。
通过以上步骤,可以在Dedecms织梦系统中成功生成wap手机版静态页,以下是相关问答FAQs:
FAQs:
1、如何在Dedecms织梦系统中创建手机版的文章模板?
在templets目录下创建wap文件夹,并在其中创建文章模板文件article_article.htm,保存路径为/templets/wap/article_article.htm。
2、如何在Dedecms织梦系统中更新WAP主页、栏目和文档?
更新WAP主页:复制dede/makehtml_homepage.php文件并重命名为makehtml_homepagewap.php,修改最后一行以包含WAP主页模板,更新WAP栏目:复制dede/makehtml_list.php文件并重命名为makehtml_listwap.php,修改最后一行以包含WAP栏目模板,更新WAP文档:复制dede/makehtml_archives.php文件并重命名为makehtml_archiveswap.php,修改最后一行以包含WAP文档模板。

QQ客服