PHPCMS V9 Website Management System content page comment on the implementation of module pseudo-static
Source: Internet
Author: User
PHPCMS V9 Web site Management System content page Comment module pseudo-static implementation
Phpcms V9 Comment Pseudo-static is based on the Listinfo support pseudo-static rules can be achieved, so we just skilled learning operation skilled use of listinfo, can be in the phpcms of any page to achieve pseudo-static paging, the following we began to gradually explain PHPCM V9 Web site Management System content page comments pseudo-static detailed implementation method.
First, comment module pseudo-static settings
1. Add a new rule to the comment module, first in the background---extension->url rule, as shown below:
{$commentid}_{$page Remember the previous ID number, such as 31, when the}.html is added.
2, the original PC tag support Urlrule, and later did not support, had to change the code, and then open the file phpcms/modules/comment/index.php found:
Include template (' comment ', ' list '); Add a few lines above it to read the Urlrule and call the comment data from the comment table, yes, the comment table is with a sub-table.
$page = intval ($_get[' page ');
$page = Max ($page, 1);
$urlrules = GetCache (' Urlrules ', ' Commons ');
$urlrule = $urlrules [31];//call URL rule
$pagesize = 10; Paging 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, ', ', ', $urlrule, Array (' commentid ' = $commentid));
$pages = $comment _data_db->pages;
}
3, the following changes to the template version, the template is actually changed the PC label, just leave the loop there can be, that is, the call to review the data label changes, delete the file phpcmstemplatesdefaultcommentlist.html:
{pc:comment action= "lists" commentid= "$commentid" siteid= "$siteid" page= "$_get[page]" hot= "$hot" num= "20"}
And the one that corresponds to it:
{/PC}
Then put the Loop statement:
{Loop $data $r}
Change to:
{Loop $comment _info $r}
Put the Paging tab:
{$pages}
Change to:
{Str_replace ("_0.html", "_1.html", $pages)}
4. Finally add the following code to the. htaccess file:
Rewriterule ^content_ (. *) _ ([0-9]+). HTML index.php?m=comment&c=index&a=init&commentid=content_$1& Page=$2
OK, now it's done, the URL shown is:
/content_9-1-1_2.html
Second, the tag module pseudo-Static setting
1. Add a new rule in the background----extension->url rule to the comment module, as shown below:
{$tag}_{$catid}_{$page}.html to remember the previous ID number, such as 32, when added.
2. Open phpcms/modules/content/tag.php file to find:
$total = $this->db->number; This line adds the following code to the top:
{app_path}index.php?m=content&c=tag&catid={$catid}&tag={urlencode ($keyword)}
Change to:
{App_path} {UrlEncode ($keyword)}_{$catid}_1.html
Open the phpcmstemplatesdefaultcontenttag.html and put the Paging tab:
{$pages}
Change to:
{Str_replace ("_0.html", "_1.html", $pages)}
4. Add the following code to the. htaccess file:
Rewriterule ^ (. *) _ ([0-9]+) _ ([0-9]+). HTML index.php?m=content&c=tag&catid=$2&tag=$1&page=$3
The last URL style shown is as follows:
/keyword _6_1.html
Summary: In fact, the above changes are in the Listinfo support pseudo-static rules on the basis of modification, skilled use of listinfo, can be in the phpcms of any page to achieve pseudo-static paging.
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.