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
|