实现手机端(WAP版)静态生成对于提升网站性能和用户体验至关重要。以下将详细介绍如何在DedeCMS中实现这一功能,确保每个步骤清晰明了。

一、添加后台导航栏目链接

首先需要修改后台菜单以支持WAP页面的生成。


1 打开dede/inc/inc_menu.php,在146行下面添加代码:



    

二、更新WAP主页

接下来配置WAP主页的生成逻辑:

1. 复制文件dede/makehtml_homepage.php,重命名为makehtml_homepagewap.php
2. 打开makehtml_homepagewap.php,找到最后一行:


include DedeInclude('templets/makehtml_homepage.htm');
    

修改为:

include DedeInclude('templets/makehtml_homepagewap.htm');
    

3. 复制文件dede/templets/makehtml_homepage.htm,重命名为makehtml_homepagewap.htm
4. 打开dede/templets/makehtml_homepagewap.htm 修改21行:


修改为:


    

5. 修改36行,指定生成WAP主页模板:


    

6. 修改48行,指定生成WAP主页路径:


    

三、更新WAP栏目页

1. 复制文件dede/makehtml_list.php,重命名为makehtml_listwap.php
2. 打开makehtml_listwap.php,找到最后一行:


include DedeInclude('templets/makehtml_list.htm');
    

修改为:

include DedeInclude('templets/makehtml_listwap.htm');
    

3. 复制文件dede/templets/makehtml_list.htm 重命名为makehtml_listwap.htm ,修改第10行:


    

修改为:


    

四、更新WAP文档

最后是文档页面的静态化设置:

1. 复制dede/makehtml_archives.php 重命名为makehtml_archiveswap.php 修改最后一行:


include DedeInclude('templets/makehtml_archives.htm');
    

修改为:

include DedeInclude('templets/makehtml_archiveswap.htm');
    

注意事项:DEDEcms手机目录默认是m,用户可根据实际需求调整。此外,也可考虑使用插件简化操作流程。