PHP article content pagination and generate corresponding HTM static file instance

Source: Internet
Author: User
Keywords Web Programming PHP Tutorials
Tags class code content file files pagination paging php

PHP Tutorial article content pagination and generate corresponding HTM static file instance


$tmpBody = "FJKA;FJSA; {page} batch generation divided into files and plus paging code ";


   


$tmpUrl = ' www.jzread.com ';


$tmpUrlarray = Explode ('. ', $url);


   


$tmpArray = explode (' {page} ', $tmpBody);


$total = count ($tmpArray);


   


if ($total >1)


    {


$tmpStr = ';


for ($i =0; $i < $total; $i + +)//traverse all paging


     {     


if ($i ==0)


      {     


$str. = "<a href=". $rs [' S_url ']. ' Class=bodypage target=_self> '. ($i + 1). ' </a> ';


      }


Else


      {


$str. = "<a href=". $rs [' id ']. ' _ '. $i. htm class=bodypage target=_self> '. ($i + 1). ' </a> ';


      }     


     }    


//batch generation into file and plus paging code


    


$str = ' <div class=mupage> '. $str. ' </div> ';


for ($j =0; $j < $total; $j + +)


     {


     


if ($j ==0)


      {     


$fname = $rs [' id ']. HTM ';


      }


Else


      {


$fname = $rs [' id ']. _ '. $j. htm ';


      }     


$tempMu = Str_replace (' {htmlcontent} ', $tmpArray [$j]. $str, $tempLate);


makehtml ($tempMu, $filePath, $fname); This function does not explain that a file creation code


     }


$mupage = 1;


    


    }


   


$tempLate = Str_replace (' {htmlcontent} ', $tmpBody, $tempLate); Ordinary articles are saved to an array regeneration page address with {page} paging, and then the HTM page is generated from the contents of the array based on explode, and the original site is reproduced with the source www.jzread.com


$total = 0;


$str = ';


$i = 0;


$j = 0;


    /*


This code generation principle is id_ page number such as 100_1.htm,100_2.htm, first of the


    */


?>


Related Article

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.