Provides various official and user-released code examples. For code reference, you are welcome to exchange and learn [recommended] dededecms mobile thinkphp Coding
The landlord is a little dumb and doesn't even use it.
//----------------------------------------------------------
// Declaration: This code is not perfect. It may not be good. Please speak out!
// Author: xiaozeng
// Deduction: 839024615
// Website: www.yun8888.net
// About my ThinkPHP: http://www.thinkphp1.cn/u/87696.html
//----------------------------------------------------------
// If we use dedecms to build a website
// What about zhimeng? static full-site html is very powerful, of course, in terms of thinkphp
// Each has its own advantages, but zhimeng does not have a mobile station. I use thinkphp to develop a mobile station separately.
// The Code is as follows:
// Homepage
Public function index (){
$ Data = M ("archives ");
// The latest meitu
Import ('org. Util. page ');
$ Count = $ Data-> count ();
$ Page = new Page ($ count, 10 );
$ Show = $ Page-> show ();
$ New = $ Data-> order ('pubdate desc')-> limit ($ Page-> firstRow. ','. $ Page-> listRows)-> select ();
$ This-> assign ("New", $ New );
// Magic Lamp
$ Where ['flag'] = array ('like', '% f % ');
$ F = $ Data-> where ($ where)-> order ('pubdate desc')-> limit (5)-> select ();
$ This-> assign ("F", $ F );
// Recommended
$ C = $ Data-> where ("flag like '% a %'")-> order ('pubdate desc')-> limit (6)-> select ();
$ This-> assign ("C", $ C );
$ This-> display ();
}
// List page
Public function index (){
$ Id = I ('get. id ');
$ P = I ('get. P ');
$ Db = M ("archives ");
// The latest meitu
Import ('org. Util. page ');
$ Where ['typeid'] = $ id;
$ Count = $ db-> where ($ where)-> count ();
$ Page = new Page ($ count, 40 );
$ Show = $ Page-> show ();
$ List = $ db-> where ($ where)-> order ('pubdate desc')-> limit ($ Page-> firstRow. ','. $ Page-> listRows)-> select ();
$ This-> assign ("list", $ list );
$ This-> assign ("page", $ show );
$ This-> assign ("id", $ id );
$ This-> display ();
}
// Article Page
Public function index (){
$ Id = I ('get. id ');
$ Db = M ("archives ");
$ Where ['id'] = $ id;
$ F = $ db-> where ($ where)-> find ();
$ This-> assign ("F", $ F );
$ This-> assign ("id", $ id );
$ This-> display ();
}
// The functions used below
// Add the table with the operator
Function get_article ($ id, $ name ){
$ Db = M ("addonarticle ");
$ Where ['aid '] = $ id;
$ F = $ db-> where ($ where)-> find ();
Return $ F [$ name];
}
// Obtain the category name
Function get_type ($ id, $ name ){
$ Db = M ("Arctype ");
$ Where ['id'] = $ id;
$ F = $ db-> where ($ where)-> find ();
Return $ F [$ name];
}
// Retrieve configuration
Function get_config ($ name ){
$ Db = M ("sysconfig ");
$ Where ['varname'] = $ name;
$ F = $ db-> where ($ where)-> find ();
Return $ F ['value'];
}
// This is a simple example. If you want to allocate all the templates, move your mind.
// Case study m.iycms.com
//----------------------------------------------------------
// Declaration: This code is not perfect. It may not be good. Please speak out!
// Author: xiaozeng
// Deduction: 839024615
// Website: www.yun8888.net
// About my ThinkPHP: http://www.thinkphp1.cn/u/87696.html
//----------------------------------------------------------
AD: truly free, domain name + VM + enterprise mailbox = 0 RMB