主站www.abc.com 手机站 wap.abc.com
1.安装手机wap浏览 模块
2.根目录创建 wap文件夹 ,将 templets\wap 文件移入 根目录下的 wap, 如图:
php
if(isset($_SERVER['HTTP_USER_AGENT']))
{
$clientkeywords = array('nokia','sony','ericsson','mot','samsung','htc','sgh','lg','sharp','sie-','philips','panasonic','alcatel','lenovo','iphone','ipod','blackberry','meizu','android','netfront',
'symbian','ucweb','windowsce','palm','operamini','operamobi','openwave','nexusone','cldc','midp','wap','mobile');
// 从HTTP_USER_AGENT中查找手机浏览器的关键字if (preg_match("/(".implode('|',$clientkeywords).")/i",strtolower($_SERVER['HTTP_USER_AGENT']))){
?>
window.location.href='http://wap.abc.com';
PHP
}
}
?>
8.wap站添加 搜索
修改 wap.php
else if($action=='search')
{
$needCode = 'UTF-8';
if(empty($keyword)) exit('Error!');
require_once(dirname(__FILE__)."/../include/datalistcp.class.php");
$varlist = "cfg_webname,cfg_templeturl";
ConvertCharset($varlist);
$dlist = new DataListCP();
$dlist->SetTemplet($cfg_templets_dir."/wap/search.wml");
$dlist->pageSize = 10;
$dlist->SetParameter("action","search");
$dlist->SetParameter("keyword",$keyword);
$dlist->SetSource("Select id,title,pubdate,click From `#@__archives` where title like '%". iconv("UTF-8", "GB2312",$keyword)."%' And arcrank=0 order by id desc");
$dlist->Display();
exit();
}
二、模版内容的一些人性化修改,其修改均在根目录下的wap.php文件中:
1、导航的分隔:
第18行
$channellist .= "{$row->typename} ";
你可以改成
$channellist .= "{$row->typename} | ";
后面加上竖线可以分隔开每个导航标签,这样查看不会太乱,挤一块;
2、文章内容的排序:
第72行
$dlist->SetSource("Select id,title,pubdate,click From `dede_archives` where typeid in($sids) And arcrank=0 order by id desc");
你可以改为:
$dlist->SetSource("Select id,title,pubdate,click From `dede_archives` where typeid in($sids) And arcrank=0 order by pubdate desc");
这样,文章就可以换你写的发布时间排序了,要不,可能将你后发布,但发布时间在以前的文章显示在了前面(比如你想要给去年补一篇文章,改了这个,它就不会把去年的文章显示在前面了。
①福鼎生活网上发布的所在信息未经本网授权,不得转载、摘编或利用其它方式使用。已经本网授权使用作品的,应在授权范围内使用,并注明“来源:福鼎生活网”或“来源:http://www.51ggwu.com”。违反上述声明者,本网将追究其相关法律责任。
②本网转载其他媒体稿件是为了传播更多的信息,此类稿件不代表本网观点。如果本网转载的稿件涉及您的版权、名誉权等问题,请尽快与本网联系,本网将依照国家相关法律法规尽快删除处理。