Home > php教程 > php手册 > 【推荐】dedecms手机版 thinkphp编写

【推荐】dedecms手机版 thinkphp编写

WBOY
Release: 2016-06-07 11:38:10
Original
1278 people have browsed it

【推荐】dedecms手机版 thinkphp编写
楼主傻B多,即然没用进来干刁
 //----------------------------------------------------------<br>  //声明: 本代码并非完美,也许存在不佳之处,请放肆吐槽!<br>  //作者: 小曾<br>  //扣扣: 839024615<br>  //网址: www.yun8888.net<br>  //关于我的ThinkPHP: http://www.thinkphp.cn/u/87696.html<br>  //----------------------------------------------------------<br> <br>  //假如我们用dedecms织梦建了一个网站<br>  //织梦呢,全站html静态化,功能非常强大,当然与thinkphp来说<br>  //各有优势,但织梦没有手机站,我就用thinkphp单独开发一个手机站<br>  //代码如下<br> <br> <br> <br>  //首页<br>     public function index(){<br>         <br>         $Data=M("archives");<br>         //最新美图<br>         import('ORG.Util.Page');<br>         $count=$Data->count();<br>         $Page=new Page($count,10);<br>         $show=$Page->show();<br>         $New=$Data->order('pubdate desc')->limit($Page->firstRow.','.$Page->listRows)->select();<br>         $this->assign("New",$New);<br>         //幻灯<br>         $where['flag']= array('like','%f%');<br>         $F=$Data->where($where)->order('pubdate desc')->limit(5)->select();<br>         $this->assign("F",$F);<br>         //推荐<br>         $C=$Data->where("flag like '%a%'")->order('pubdate desc')->limit(6)->select();<br>         $this->assign("C",$C);<br>         $this->display();<br>     }<br> <br> <br> //列表页<br> <br>   public function index(){<br>         $id=I('get.id');<br>         $p=I('get.p');<br>         $db=M("archives");<br>         //最新美图<br>         import('ORG.Util.Page');<br>         $where['typeid']=$id;<br>         $count=$db->where($where)->count();<br>         $Page=new Page($count,40);<br>         $show=$Page->show();<br>         $list=$db->where($where)->order('pubdate desc')->limit($Page->firstRow.','.$Page->listRows)->select();<br>         $this->assign("list",$list);<br>     $this->assign("page",$show);<br>         $this->assign("id",$id);<br>         $this->display();<br>     }<br> <br> <br> //文章页<br> <br>     public function index(){<br>         $id=I('get.id');<br>         $db=M("archives");<br>         $where['id']=$id;<br>         $F=$db->where($where)->find();<br>         $this->assign("F",$F);<br>         $this->assign("id",$id);<br>         $this->display();<br>     }<br> <br> <br> //下面所用到的函数<br> <br> //取符加表<br> function get_article($id,$name){<br>     $db=M("addonarticle");<br>     $where['aid']=$id;<br>     $F=$db->where($where)->find();<br>     return $F[$name];<br> }<br> //取分类名称<br> function get_type($id,$name){<br>     $db=M("Arctype");<br>     $where['id']=$id;<br>     $F=$db->where($where)->find();<br>     return $F[$name];<br> }<br> //取配置<br> function get_config($name){<br>     $db=M("sysconfig");<br>     $where['varname']=$name;<br>     $F=$db->where($where)->find();<br>     return $F['value'];<br> }<br> <br> <br> //这是简单的写了一下,如果你对模板都要分配的话,自己动动脑吧<br> <br> //案例  m.iycms.com<br> <br> <br>  //----------------------------------------------------------<br>  //声明: 本代码并非完美,也许存在不佳之处,请放肆吐槽!<br>  //作者: 小曾<br>  //扣扣: 839024615<br>  //网址: www.yun8888.net<br>  //关于我的ThinkPHP: http://www.thinkphp.cn/u/87696.html<br>  //----------------------------------------------------------

AD:真正免费,域名+虚机+企业邮箱=0元

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template