Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of automatically generating html for pages by Imperial cms

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the Imperial cms to achieve page automatic generation of html method, has a certain reference value, friends in need can refer to. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.

How does Imperial cms automatically generate html for pages?

This paper gives an example of how Imperial cms realizes the automatic generation of html for users to visit the page. Share it with you for your reference. The specific analysis is as follows:

Reason: for websites with limited server resources but a large amount of data, it is slow to use Imperial cms to generate all files in batches. If you change the template once, it often takes a long time to update.

Idea: delete all html- > use nginx to match ungenerated html- > php to generate html. If nginx detects that html has been generated, display it directly and do not jump to php.

The implementation code is as follows:

The code is as follows:

Location / {alias / home/web/xxx.com/; if (!-e $request_filename) {rewrite / (. *) / (. *). Html$ / chtml.php?classid=1&id=$2&ssid=$2&check=checkcode;}}

In the above configuration, when users visit a html that does not exist, the contents of the chtml.php will be automatically displayed, and the URL will not jump, which is equivalent to the current URL.

3.php generation:

The file 1:chtml.php code is as follows:

The code is as follows:

File 2 modification:

E/class/chtmlfun.php

Find the ReSingleInfo method before:

The code is as follows:

$sql=$empire- > query ("select * from {$dbtbpre} ecms_". $class_r [$classid] [tbname]. "where". $add)

Added: the following code:

The code is as follows:

/ * generate a single file 2014-5-8 shanmao*/ $s_aid = (int) $_ GET ['ssid']; if ($s_aid > 0) {$add= "id=$s_aid"; $classid=58;// your column id} / * generate a single file at the foreground * /

File 3 modification: add a code at the end of the functions.php GetHtml method to directly display the generated html:

The code is as follows:

/ * Show html 2014-5-8 * / $s_aid = $_ GET ['ssid']; $s_play = (int) $_ GET [' play']; $GET checkout = $_ GET ['check']; if ($s_aid & strstr ($s_aid, "_ play") {echo file_get_contents ($file_p);} else {echo file_get_contents ($file);} / * directly show html 2014-5-8 * /

Thank you for reading this article carefully. I hope the editor will share the content of Imperial cms to automatically generate html on the page. At the same time, I also hope that you will support us, pay attention to the industry information channel, and find out if you encounter problems. Detailed solutions are waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report