PHP implements static full site homepage static list page static content static

Source: Internet
Author: User
Function  Staticindex (){  $ Content = $ Smarty -> Fetch('index.html ', True ); //  This is the built-in function for generating static pages.  $ Static_name = Root_path.'index.html '; //  This is the current path file for generating static pages  Fopen ( $ Static_name , 'A '); //  Open this file @  File_put_contents ( $ Static_name , $ Content ); //  Last written in  Return   True  ;}  //  Static list page, static by category  Function Staticcontent (){ //  Number of static calls required    $ IDS =Array (); //  Get all content     $ IDS = $ This -> Getlistids (); //  This method gets all the content. The red text below corresponds to its method.     Foreach ( $ IDS   As   $ K => $ Value  ){  //  Echo $ value ['catid'];     If (! File_exists (Root_path. 'demo /')){ //  Check whether this folder is in the root directory. If not, create the demo folder.       Mkdir (Root_path. 'demo /' );}  If (! File_exists (Root_path. 'demo /'. $ Value ['Catid']) { //  Check whether there is a corresponding category folder under this folder.        Mkdir (Root_path. 'demo /'. $ Value ['Catid']);}  $ Html_content = $ This -> Getdemocontent ( $ Value ['Demoid' ]);  $ Static_name = Root_path. 'demo /'. $ Value ['Catid']. '/'. $ Value Using 'demoid'0000.'.html' ;  Fopen ( $ Static_name , 'A' );@  File_put_contents ( $ Static_name , $ Html_content  );}  Return   True  ;}  //  Obtain the page ID to be static    Function  Getlistids (){  $ SQL = "Select * from { $ This -> Tablepre} demo order by demoid ASC" ;  $ Rs =$ This -> DB-> getall ( $ SQL  );  If ( $ Rs  ){  Return   $ Rs  ;}  Else  {  Return   False  ;}}  //  Static content single page  Function Getdemocontent ( $ ID  ){  Global   $ Smarty , $ View_templates , $ Admin_templates  ; Loadmodel (  Array ('Demo' ));  $ Demo = New  Demo ();  $ Content ='';  $ Smarty -> Template_dir = root_path. $ View_templates  ;  $ Getmobanone = $ This -> Getmobandetail ( $ ID  );  $ Mobandetail = $ Demo -> Mobanlist ( $ ID  );  Foreach ( $ Mobandetail  As   $ K => $ V  ){  $ Smarty -> Assign ( $ K , $ V  );}  $ This -> Catid = $ Getmobanone ['Catid' ];  $ Smarty -> Assign ('pre _ title ', $ Mobandetail ['Membername' ]); $ Smarty -> Assign ('mobandetail ', $ Mobandetail  );  $ Content = $ Smarty -> Fetch('demo_show.html ', True  );  $ Smarty -> Template_dir = root_path. $ View_templates  ;  Return   $ Content  ;} 

 

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.