PHPCMS v9 Custom HTML file name

Source: Internet
Author: User

Used to weave dreams, Wordpress, Zblog and other programs, users know that when the content can be customized to generate HTML file name, this feature is very good for SEO, but after V9 but unfortunately, this function is not, Now all you have to do is make a small change to V9 to make V9 have the ability to customize the HTML file name, by doing the following:

1, modify the model you need to set, add a field, configured as follows:

2. Open the/phpcms/modules/content/create_html.php and find the code:

$urls $this->url->show ($r$r[' catid '],$r[' inputtime ']);

Bulk replacements are:

$urls $this->url->show ($r$r[' catid '],$r$r[' prefix ']);

A total of three code to allow the generated HTML page to customize the file name.

3. Open the/phpcms/modules/content/classes/url.class.php and find the code:

$day Date (' d ',$time);

Insert below:

$tmp _id $content _ishtml $prefix $prefix $id // added support for custom HTML file names

Find the code again

$urls Str_replace (array(' {$categorydir} ', ' {$catdir} ', ' {$year} ', ' {$month} ', ' {$day} ', ' {$catid} ', ' {$id} ', ' {$page} '),  Array($categorydir,$catdir,$year,$month,$day,$catid ,$id,$page),$urlrule);

Modified to:

$urls Str_replace (array(' {$categorydir} ', ' {$catdir} ', ' {$year} ', ' {$month} ', ' {$day} ', ' {$catid} ', ' {$id} ', ' {$page} '),  Array($categorydir,$catdir,$year,$month,$day,$catid ,$tmp _id,$page),$urlrule);

Here, the name of the generated HTML page is customized. Configure the URL rules later, still using the form of ID.

PHPCMS v9 Custom HTML file name

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.