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 generating static pages in phpcms v9

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

Share

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

How does phpcms v9 generate static pages? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!

How does phpcms v9 generate static pages?

Recently, when customers were optimizing the website, they specifically asked Phpcms V9 how to be static and pseudo-static. CMSYOU remembered that he had shared "Phpcms custom URL rules skills" before, but that was just the principle. Here today, I would like to share with you the actual operation from the point of view of use.

Related recommendation: phpcms tutorial

First talk about how Phpcms V9 sets up to generate static HTML in the background, and then explains how to customize URL rules to optimize URL addresses. In this article, pseudo-static is not involved, you can move to the Phpcms V9 site-wide pseudo-static setting method.

Static HTML generation settings

Go to the PHPCMS V9 backend settings and find the category column. Location: content-> Management column-> add column (or management column, click "modify" in the corresponding column):

Pay attention to setting the second tab, "generate HTML settings", and capture the details:

After confirming the submission, remember to update the column cache, and then release management: batch update column page, batch update content page.

II. PHPCMS V9 custom URL rules and URL address optimization

First, take a look at the html generation principle of PC v9:

The static page directory rules generated by Phpcms are generated in accordance with the URL rules. The static page content is phpcms\ templates\ default generated by the ob_clean foreground template file. Static page debugging: modify the static page, regenerate the static page and see the effect. You can also call the foreground control / index.php?m=openservice&c=index&a=openservice to modify the foreground template and generate it again.

As long as it is a static page links should be timely synchronization of files, to prevent dead links, data errors.

Based on this, we can customize the URL generation rules in the background extension URL rule management, specific location: extension > URL rule management.

1. The default column generation rules are:

{$categorydir} {$catdir} / index.html | {$categorydir} {$catdir} / {$page} .html

When the html is generated, it will be displayed as: news/cmsyou/1000.html.

There is a slight problem with this. If the list has multiple pages, then the second page only generates a numeric html. For example, 2.html represents the second page of the list, and CMSYOU suggests changing it to:

{$categorydir} {$catdir} / index.html | {$categorydir} {$catdir} / index_ {$page} .html

Generated according to the column index page, the column list becomes: index.html, index_2.html, index_3.html... It's clearer this way.

If you want to customize the generation to a fixed directory, you can add a specific English directory before.

2. The default generation rules for article pages are:

{$year} / {$catdir} _ {$month} {$day} / {$id} .html | {$year} / {$catdir} _ {$month} {$day} / {$id} _ {$page} .html

Or:

{$categorydir} {$catdir} / {$year} / {$month} {$day} / {$id} .html | {$categorydir} {$catdir} / {$year} / {$month} {$day} / {$id} _ {$page} .html

The HTML web page directory generated by such a rule is too deep, and CMSYOU recommends that you modify it to:

{$categorydir} {$catdir} / {$id} .html | {$categorydir} {$catdir} / {$id} _ {$page} .html

The HTML static file generated in this way is only at the root of the column, which is easy to manage and beneficial to SEO. For example, http://www.cmsyou.com/support/84.html this is an article under the CMSYOU help article. Removing the following 84.html is the first page of the column, so it is direct.

3. Optimization of single page generation rules

There is only one default way to generate a single page, and CMSYOU recommends adding one:

{$categorydir} {$catdir} .html

So the single page of the secondary directory only generates a html, not a directory, which is beneficial to the HTML architecture. Screenshots of sharing settings:

In this way, after sharing the Phpcms V9 column, inner page, single page generation rules and optimization examples, do you know the custom HTML generation rules?

Thank you for reading! After reading the above, do you have a general idea of how phpcms v9 generates static pages? I hope the content of the article will be helpful to all of you. If you want to know more about the relevant articles, you are welcome to follow the industry information channel.

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