[Recommended] dededecms for thinkphp

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.