Php uses smarty to generate static page code in php articles

Source: Internet
Author: User
Tags smarty template
Php uses smarty to generate static page code in php articles
This article describes how to use the smarty template engine to generate static pages in php and how to implement the code in php for pagination. For more information, see.

For example, in php, smarty generates static pages and paging code in articles. Topic: Principles of php paging code

      

', $ Content); $ num = 0; foreach ($ temp as $ key => $ val) {$ num ++; $ pagenav = ''; if ($ key = 0) {$ file_name = '.. /html/'.w.article_id.'.html ';} else {$ file_name = '.. /html/'.w.article_id.'_'.(?key=1}.'.html ';} for ($ I = 1; $ I <= count ($ temp); $ I ++) {if ($ key + 1) ==$ I) {$ pagenav. ="{$ I}";} Else {if ($ I = 1) {$ pagenav = $ pagenav. "{$ I}";} else {$ pagenav. = "{$ I}" ;}}$ _ POST ['content'] = $ val; $ tpl-> assign ('A', $ _ POST ); $ tpl-> assign ('pagenav', $ pagenav); $ html = $ tpl-> fetch('show_article.html '); $ fp = fopen ($ file_name, 'w '); if ($ fp) {fwrite ($ fp, $ html); fclose ($ fp) ;}} alert ("{$ num} generation succeeded", 'Add _ article. php ');} else {alert (' failed to add! ') ;}} Else {// $ FCK-> Value = 'fanglor is a boy! '; $ Editer = $ FCK-> CreateHtml (); $ tpl-> assign ('editer', $ editer); $ tpl-> display ('add_article.html ') ;}?>

Generate static pagesRelated articles:

  • Example of using smarty to generate static files in PHP
  • Key code for generating static pages by the smarty template engine
  • Php static page generation method (three functions)
  • Two methods for generating static files in php
  • How to generate static pages using smarty

Article paginationRelated articles:

  • Php long article code sharing by page
  • Php long article paging implementation code
  • Php article paging implementation code
  • Php text article paging code example
  • Php code for pagination of long articles

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.