PHPCMSV9 website management system content page comment module pseudo-static implementation
Source: Internet
Author: User
PHPCMSV9: the pseudo-static implementation of the content page comment module of the website management system PHPCMSV9; the pseudo-static comment can be achieved only after listinfo supports pseudo-static rules. Therefore, we only need to learn how to use listinfo skillfully, we can implement pseudo-static paging on any page of phpcms. next we will begin to explain the implementation of the pseudo-static comments module in the content page comment module of PHPCMV9 website management system in PHPCMS V9 website management system.
PHPCMS V9 comments pseudo-static can be implemented only when listinfo supports pseudo-static rules. Therefore, we only need to learn how to use listinfo, we can implement pseudo-static paging on any page of phpcms. next we will begin to explain the detailed implementation of pseudo-static comments on the content page of the PHPCM V9 website management system.
I. pseudo-static settings of the comment module
1. First, add a new rule to the background-> extension-> url rule for the comment module, as shown below:
When adding successfully commentid=_00000000page0000.html, remember the preceding ID number, for example, 31.
2. Previously, the PC tag supported urlrule, but later it was not supported, so I had to change the code, so I opened the file phpcms/modules/comment/index. php and found it:
Include template ('comment', 'list'); add several rows on it to read urlrule and call comment data from the comment table. By the way, the comment table contains table shards.
$ Page = intval ($ _ GET ['Page']);
$ Page = max ($ page, 1 );
$ Urlrules = getcache ('urlrules', 'commons ');
$ Urlrule = $ urlrules [31]; // call a url rule
$ Pagesize = 10; // page size
$ Comment_db = pc_base: load_model ('comment _ Model ');
$ Comment_data_db = pc_base: load_model ('comment _ data_model ');
$ Comment = $ comment_db-> get_one (array ('commentid' => $ commentid, 'siteid' => $ siteid ));
If ($ comment ){
$ Comment_data_db-> table_name ($ comment ['tableid']);
$ Comment_info = $ comment_data_db-> listinfo (Array ('commentid' => $ commentid, 'status' => 1), 'id desc', $ page, $ pagesize, '', '10', $ urlrule, Array ('commentid' => $ commentid ));
$ Pages = $ comment_data_db-> pages;
}
3. the template will be changed below. the template will actually be changed to the pc tag, and only the loop will be left. it will be changed to the tag that calls the comment data, delete the phpcmstemplatesdefacommcommentlist.html file:
{Pc: comment action = "lists" commentid = "$ commentid" siteid = "$ siteid" page = "$ _ GET [page]" hot = "$ hot" num = "20 "}
The one corresponding to it:
{/Pc}
Then, run the loop statement:
{Loop $ data $ r}
Changed:
{Loop $ comment_info $ r}
Paging labels:
{$ Pages}
Changed:
{Str_replace ("_0.html", "_1.html", $ pages )}
4. add the following code to the. htaccess file:
RewriteRule ^ content _ (. * pai_(%0-9%%%%%.html index. php? M = comment & c = index & a = init & commentid = content _ $1 & page = $2
OK. Now we can see the following URL:
Content_9-1-1_2.html
II. pseudo-static settings of the TAG module
1. add a new rule to the background-> extension-> url rule for the comment module, as shown below:
When tagtag1__1_1_catid1__1_1_page0000.html is added, remember the preceding ID number, for example, 32.
2. open the phpcms/modules/content/tag. php file and find:
$ Total = $ this-> db-> number; // add the following code to the row:
{APP_PATH} index. php? M = content & c = tag & catid = {$ catid} & tag = {urlencode ($ keyword )}
Changed:
{APP_PATH}{urlencode($keyword)}_{$catid}_1.html
Open phpcmstemplatesdefaultcontenttag.html, and set the page tag:
RewriteRule ^ (. * )_(%0-9%%%%%_(%0-9%%%%%.html index. php? M = content & c = tag & catid = $2 & tag = $1 & page = $3
The URL style shown at the end is as follows:
/Key word _6_1.html
Summary: In fact, all the above modifications are based on the support of pseudo-static rules in listinfo. you can use listinfo to implement pseudo-static paging on any page in phpcms.
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.