web建站教程
  1. 首页
  2. vuejs
  3. js
  4. 好玩
  5. AIGC工具
  6. 前端知识
  7. 百度echarts
  8. 更多
    php入门
    nodejs
    mockjs
    reactjs
    mysql
    wordpress
    织梦cms
    帝国cms
    git教程
    IT知识
    模板大全
    休息站
    手机应用

帝国CMS技巧之如何实现模板列表页和内容页的伪

725 ℃

帝国cms技巧之如何实现模板列表页和内容页的伪静态规则
在栏目设置—-生成选项里面

列表模式 和 内容页模式 依然选择静态

然后在其他一些选择是否生成列表页内容页的选项里面都选择不生成就可以了

以下的是列表页的==================================
为了不影响到使用结合项的功能

第一步:
复制 eactionListInfo.php 为 ListInfo_wjt.php

第二步:
打开 ListInfo_wjt.php

第三步:
找到:
$page=(int)$_GET['page'];
改成:
$page=(int)$_GET['page']-1;//cmsdm.cn 伪静态修改标记

第四步:
找到:
$listpage=page1($num,$line,$page_line,$start,$page,$search);
改成:
$listpage=pagewjt($num,$line,$page_line,$start,$page,$search,$dolink);//cmsdm.cn 伪静态修改标记

第五步:

打开 eclassconnect.php

找到://前台分页 在上面加上以下代码

//列表页伪静态———–cmsdm.cn

function pagewjt($num, $line, $page_line, $start, $page, $search, $dolink) {
global $fun_r;
if ($num <= $line) {
return '';
}
$type = '.html';
$url = $_SERVER['PHP_SELF'].
'?page';
$snum = 2; //最小页数
$totalpage = ceil($num / $line); //取得总页数 $firststr='' ; //上一页 if($page<>0)
{
$toppage = '<a href="'.$dolink.
'index'.$type.
'">'.$fun_r['startpage'].
'</a>';
$pagepr = $page;
if ($pagepr == 1)
{
$prido = "index".$type;
} else
{
$prido = "index_".$pagepr.$type;
}
$prepage = '<a href="'.$dolink.$prido.
'">'.$fun_r['pripage'].
'</a>';
}
//下一页
if ($page != $totalpage – 1)
{
$pagenex = $page + 2;
$nextpage = '<a href="'.$dolink.
'index_'.$pagenex.$type.
'">'.$fun_r['nextpage'].
'</a>';
$lastpage = '<a href="'.$dolink.
'index_'.$totalpage.$type.
'">'.$fun_r['lastpage'].
'</a>';
}
$starti = $page – $snum < 1 ? 1 : $page – $snum;
$no = 0;
for ($i = $starti; $i <= $totalpage && $no < $page_line; $i++) {
$no++;
if ($page == $izzi) {
$is_1 = '<a class="on" href="#">';
$is_2 = "</a>";
}
elseif($i == 1) {
$is_1 = '<a href="'
.$dolink.
'index'.$type.
'">';
$is_2 = "</a>";
}
else
{
$is_1 = '<a href="'.$dolink.
'index_'.$i.$type.
'">';
$is_2 = "</a>";
}
$izzi = $i;
$izz = $i + 2;
$pagenum = $i;
$returnstr. = "".$is_1.$pagenum.$is_2;
}

$returnstr = $firststr.$toppage.$prepage.$returnstr.$nextpage.$lastpage;
return $returnstr;
}

以下为列表页伪静态规则

RewriteRule ^栏目目录名/$ e/action/ListInfo_wjt.php?page=1&classid=栏目id
RewriteRule ^栏目目录名/index.html$ e/action/ListInfo_wjt.php?page=1&classid=栏目id
RewriteRule ^栏目目录名/index_([0-9]+).html$ e/action/ListInfo_wjt.php?page=$1&classid=栏目id

这样的话 每个栏目都需要3条规则,对于栏目少的话 不太所谓 如果栏目多的话 你可以在栏目目录名的地址使用([a-z]+)来代替 但需要自己修改一下 ListInfo_wjt.php 给予classid数值

这个方法是比较简单的方法,不太会php,高手别见笑!

本人两个站 内容页和列表页都是伪静态的

以下是内容页的伪静态

打开 eactionShowInfo.php
找到:$page=(int)$_GET['page'];

改成:$page=(int)$_GET['page']-1;
把以下的内容删除

//是否支持动态内容页
if($class_r[$classid]['showdt']!=2)
{
$titleurl=sys_ReturnBqTitleLink($r);
Header("Location:$titleurl");
exit();
}
找到:$search="&classid=$classid&id=$id";
改成:$search="$id";
找到:$truepage=page1($thispagenum,$line,$page_line,$start,$page,$search);
改成:$truepage=pagewjt_1($thispagenum,$line,$page_line,$start,$page,$search,$dolink);//cmsdm.cn
打开 eclassconnect.php
找到
//前台分页

在上面加上以下代码

//内容页伪静态———–cmsdm.cn

function pagewjt_1($num, $line, $page_line, $start, $page, $search, $dolink) {
global $fun_r;
if ($num <= $line)
{
return '';
}
$search = htmlspecialchars($search, ENT_QUOTES);
$type = '.html';
$url = $_SERVER['PHP_SELF'].
'?page';
$snum = 2; //最小页数
$totalpage = ceil($num / $line); //取得总页数
$firststr = '';
//上一页
if ($page < > 0)
{
$toppage = '<a href="'.$dolink.$search.$type.
'">'.$fun_r['startpage'].
'</a>';
$pagepr = $page;
if ($pagepr == 1)
{
$prido = $search.$type;
} else
{
$prido = $search.
"_".$pagepr.$type;
}
$prepage = '<a href="'.$dolink.$prido.
'">'.$fun_r['pripage'].
'</a>';
}
//下一页
if ($page != $totalpage – 1)
{
$pagenex = $page + 2;
$nextpage = '<a href="'.$dolink.$search.
'_'.$pagenex.$type.
'">'.$fun_r['nextpage'].
'</a>';
$lastpage = '<a href="'.$dolink.$search.
'_'.$totalpage.$type.
'">'.$fun_r['lastpage'].
'</a>';
}
$starti = $page – $snum < 1 ? 1 : $page – $snum;
$no = 0;
for ($i = $starti; $i <= $totalpage && $no < $page_line; $i++)
{
$no++;
if ($page == $izzi)
{
$is_1 = '<a class="on" href="#">';
$is_2 = "</a>";
}
elseif($i == 1)
{
$is_1 = '<a href="'.$dolink.$search.$type.
'">';
$is_2 = "</a>";
} else
{
$is_1 = '<a href="'.$dolink.$search.
'_'.$i.$type.
'">';
$is_2 = "</a>";
}
$izzi = $i;
$izz = $i + 2;
$pagenum = $i;
$returnstr. = "".$is_1.$pagenum.$is_2;
}
$returnstr = $firststr.$toppage.$prepage.$returnstr.$nextpage.$lastpage;
return $returnstr;
}

以下为内容页伪静态规则

RewriteRule ^栏目目录名/([0-9]+).html$ e/action/ShowInfo.php?classid=栏目id&id=$1&page=1
RewriteRule ^栏目目录名/([0-9]+)_([0-9]+).html$ e/action/ShowInfo.php?classid=栏目id&id=$1&page=$2

 

利用php语法实现一个哔哩哔哩热榜api

php删除接口:在指定的数据库数据表中根据ID删除指定的数据

php插入接口:在指定的数据库数据表中插入数据

php语法对index.php首页进行判断(根据需要显示不同页面)

html文本如何读取数据库代码示例

标签: CMS网站 page php语法 列表 静态

上面是“帝国CMS技巧之如何实现模板列表页和内容页的伪”的全面内容,想了解更多关于 帝国cms 内容,请继续关注web建站教程。

当前网址:https://ipkd.cn/webs_1175.html

声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

当前位置: 网站首页 > 帝国cms
本文共计4416个字,预计阅读时长30分钟

基金从业资格考试题库

一站式备考基金从业资格考试,收录2021-2025年模拟题库!呱呱工具箱

AI工作站

收录全球3800+ 款各行各业AI应用,轻轻松松做事!

生活小工具

收录了万年历、老黄历、八字智能排盘等100+款小工具!生活小工具
上一篇: 推荐一款免费可商用英文字体——Atkinson Hyperlegible
下一篇: 推荐一款免费好看的中文设计字体——字体传奇特战体
x 打工人ai神器