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

How does Imperial cms realize the automatic Generation of html when users visit the Page

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article will explain in detail how Imperial cms can automatically generate html for users to visit the page. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

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.

Recommended to learn the Imperial cms course

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:

/ * the foreground generates 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} / * the foreground generates a single file * /

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:

/ * directly display 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 * / this is the end of sharing about how Imperial cms can automatically generate html for users to visit pages. I hope the above content can be of some help and learn more knowledge. If you think the article is good, you can share it for more people to see.

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