dt内核的方便性在于代码内核完全开源,都可以根据自身需要进行优化整改,个人在这段时间的深入研究,发现这套内核的方便性,今天继续给大家分享下DT的url伪静态如何自定义函数。

url自定义文件是在api/url.inc.php这个文件,dt7.0也是,下面我会一一介绍!

dt6.0的改造:

<?php
defined('IN_DESTOON') or exit('Access Denied');
include load('include.lang');//引入语言文件
$urls = array();
$urls['htm']['list'][0] = array('example'=>'('.$L['url_htm'].') catdir/25.html','index'=>'{$catdir}/{$index}.{$file_ext}', 'page'=>'{$catdir}/{$prefix}{$page}.{$file_ext}');
$urls['htm']['list'][1] = array('example'=>'('.$L['url_htm'].') 10/25.html','index'=>'{$catid}/{$index}.{$file_ext}', 'page'=>'{$catid}/{$prefix}{$page}.{$file_ext}');
$urls['htm']['list'][2] = array('example'=>'('.$L['url_htm'].') 10_25.html','index'=>'{$prefix}{$catid}.{$file_ext}', 'page'=>'{$prefix}{$catid}_{$page}.{$file_ext}');
$urls['htm']['list'][3] = array('example'=>'('.$L['url_htm'].') '.$L['category'].'/1.html','index'=>'{$catname}/{$index}.{$file_ext}', 'page'=>'{$catname}/{$page}.{$file_ext}'); $urls['htm']['item'][0] = array('example'=>'('.$L['url_htm'].') 1/125.html','index'=>'{$alloc}/{$prefix}{$itemid}.{$file_ext}', 'page'=>'{$alloc}/{$prefix}{$itemid}_{$page}.{$file_ext}');
$urls['htm']['item'][1] = array('example'=>'('.$L['url_htm'].') 200810/25/125.html','index'=>'{$year}{$month}/{$day}/{$prefix}{$itemid}.{$file_ext}', 'page'=>'{$year}{$month}/{$day}/{$prefix}{$itemid}_{$page}.{$file_ext}');
$urls['htm']['item'][2] = array('example'=>'('.$L['url_htm'].') catdir/1/125.html','index'=>'{$catdir}/{$alloc}/{$prefix}{$itemid}.{$file_ext}', 'page'=>'{$catdir}/{$alloc}/{$prefix}{$itemid}_{$page}.{$file_ext}');
$urls['htm']['item'][3] = array('example'=>'('.$L['url_htm'].') 200810/'.$L['title'].'_125.html','index'=>'{$year}{$month}/{$title}_{$itemid}.{$file_ext}', 'page'=>'{$year}{$month}/{$title}_{$itemid}_{$page}.{$file_ext}');
$urls['htm']['item'][4] = array('example'=>'('.$L['url_htm'].') catdir/200810/125.html','index'=>'{$catdir}/{$year}{$month}/{$prefix}{$itemid}.{$file_ext}', 'page'=>'{$catdir}/{$year}{$month}/{$prefix}{$itemid}_{$page}.{$file_ext}');
$urls['htm']['item'][5] = array('example'=>'('.$L['url_htm'].') 200810/125.html','index'=>'{$year}{$month}/{$prefix}{$itemid}.{$file_ext}', 'page'=>'{$year}{$month}/{$prefix}{$itemid}_{$page}.{$file_ext}'); $urls['php']['list'][0] = array('example'=>'('.$L['url_php'].') list.php?catid=1&page=2','index'=>'list.php?catid={$catid}', 'page'=>'list.php?catid={$catid}&page={$page}');
$urls['php']['list'][1] = array('example'=>'('.$L['url_php'].') list.php/catid-1-page-2/','index'=>'list.php/catid-{$catid}/', 'page'=>'list.php/catid-{$catid}-page-{$page}/');
$urls['php']['list'][2] = array('example'=>'('.$L['url_rewrite'].') list-htm-catid-1-page-2.html','index'=>'list-htm-catid-{$catid}.html', 'page'=>'list-htm-catid-{$catid}-page-{$page}.html');
$urls['php']['list'][3] = array('example'=>'('.$L['url_rewrite'].') list-1-2.html','index'=>'list-{$catid}.html', 'page'=>'list-{$catid}-{$page}.html');
$urls['php']['list'][4] = array('example'=>'('.$L['url_rewrite'].') list/1/','index'=>'list/{$catid}/', 'page'=>'list/{$catid}/{$page}/');
$urls['php']['list'][5] = array('example'=>'('.$L['url_rewrite'].') mulu-c1-2.html','index'=>'{$catdir}-c{$catid}-1.html', 'page'=>'{$catdir}-c{$catid}-{$page}.html');
$urls['php']['item'][0] = array('example'=>'('.$L['url_php'].') show.php?itemid=1&page=2','index'=>'show.php?itemid={$itemid}', 'page'=>'show.php?itemid={$itemid}&page={$page}');
$urls['php']['item'][1] = array('example'=>'('.$L['url_php'].') show.php/itemid-1-page-2/','index'=>'show.php/itemid-{$itemid}/', 'page'=>'show.php/itemid-{$itemid}-page-{$page}/');
$urls['php']['item'][2] = array('example'=>'('.$L['url_rewrite'].') show-htm-itmeid-1.html','index'=>'show-htm-itemid-{$itemid}.html', 'page'=>'show-htm-itemid-{$itemid}-page-{$page}.html');
$urls['php']['item'][3] = array('example'=>'('.$L['url_rewrite'].') show-1-2.html','index'=>'show-{$itemid}.html', 'page'=>'show-{$itemid}-{$page}.html');
$urls['php']['item'][4] = array('example'=>'('.$L['url_rewrite'].') show/1/','index'=>'show/{$itemid}/', 'page'=>'show/{$itemid}/{$page}/');
?>

  伪静态规则为:

#Rewrite Rules
ErrorDocument 404 /404.php
RewriteEngine On
RewriteRule ^(.*)\.(asp|aspx|asa|asax|dll|jsp|cgi|fcgi|pl)(.*)$ /404.php
RewriteRule ^(.*)/(admin|cache|editor|file|include|lang|module|skin|template)/(.*)\.php(.*)$ /404.php
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)/show-([0-9]+)([\-])?([0-9]+)?\.html$ $1/show.php?itemid=$2&page=$4
RewriteRule ^(.*)/list-([0-9]+)([\-])?([0-9]+)?\.html$ $1/list.php?catid=$2&page=$4
RewriteRule ^(.*)/([A-za-z0-9_\-]+)-c([0-9]+)-([0-9]+)\.html$ $1/list.php?catid=$3&catdir=$2&page=$4
RewriteRule ^(.*)/show/([0-9]+)/([0-9]+)?([/])?$ $1/show.php?itemid=$2&page=$3
RewriteRule ^(.*)/list/([0-9]+)/([0-9]+)?([/])?$ $1/list.php?catid=$2&page=$3
RewriteRule ^(.*)/([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/index.php?moduleid=$2&catid=$3&itemid=$4&page=$5
RewriteRule ^(.*)/([a-z]+)/(.*)\.shtml$ $1/$2/index.php?rewrite=$3
RewriteRule ^(com)/([a-z0-9_\-]+)/([a-z]+)/(.*)\.html$ index.php?homepage=$2&file=$3&rewrite=$4
RewriteRule ^(com)/([a-z0-9_\-]+)/([a-z]+)([/])?$ index.php?homepage=$2&file=$3
RewriteRule ^(com)/([a-z0-9_\-]+)([/])?$ index.php?homepage=$2
RewriteRule ^(.*)/kw-([A-za-z0-9]+)\.html$ $1/search.php?kw=$2

 6.0演示站点: http://zhimo.yuanzhumuban.cc/

接下来演示7.0的伪静态自定义,7.0是手机端和PC端统一的路径,这个让人很欣慰。

<?php
defined('IN_DESTOON') or exit('Access Denied');
include load('include.lang'); $urls = array(); $urls['htm']['list'][0] = array('example'=>'('.$L['url_htm'].') catdir/25.html','index'=>'{$catdir}/{$index}.{$file_ext}', 'page'=>'{$catdir}/{$prefix}{$page}.{$file_ext}');
$urls['htm']['list'][1] = array('example'=>'('.$L['url_htm'].') 10/25.html','index'=>'{$catid}/{$index}.{$file_ext}', 'page'=>'{$catid}/{$prefix}{$page}.{$file_ext}');
$urls['htm']['list'][2] = array('example'=>'('.$L['url_htm'].') 10_25.html','index'=>'{$prefix}{$catid}.{$file_ext}', 'page'=>'{$prefix}{$catid}_{$page}.{$file_ext}');
$urls['htm']['list'][3] = array('example'=>'('.$L['url_htm'].') '.$L['category'].'/1.html','index'=>'{$catname}/{$index}.{$file_ext}', 'page'=>'{$catname}/{$page}.{$file_ext}'); $urls['htm']['item'][0] = array('example'=>'('.$L['url_htm'].') 1/125.html','index'=>'{$alloc}/{$prefix}{$itemid}.{$file_ext}', 'page'=>'{$alloc}/{$prefix}{$itemid}_{$page}.{$file_ext}');
$urls['htm']['item'][1] = array('example'=>'('.$L['url_htm'].') 200810/25/125.html','index'=>'{$year}{$month}/{$day}/{$prefix}{$itemid}.{$file_ext}', 'page'=>'{$year}{$month}/{$day}/{$prefix}{$itemid}_{$page}.{$file_ext}');
$urls['htm']['item'][2] = array('example'=>'('.$L['url_htm'].') catdir/1/125.html','index'=>'{$catdir}/{$alloc}/{$prefix}{$itemid}.{$file_ext}', 'page'=>'{$catdir}/{$alloc}/{$prefix}{$itemid}_{$page}.{$file_ext}');
$urls['htm']['item'][3] = array('example'=>'('.$L['url_htm'].') 200810/'.$L['title'].'_125.html','index'=>'{$year}{$month}/{$title}_{$itemid}.{$file_ext}', 'page'=>'{$year}{$month}/{$title}_{$itemid}_{$page}.{$file_ext}');
$urls['htm']['item'][4] = array('example'=>'('.$L['url_htm'].') catdir/200810/125.html','index'=>'{$catdir}/{$year}{$month}/{$prefix}{$itemid}.{$file_ext}', 'page'=>'{$catdir}/{$year}{$month}/{$prefix}{$itemid}_{$page}.{$file_ext}');
$urls['htm']['item'][5] = array('example'=>'('.$L['url_htm'].') 200810/125.html','index'=>'{$year}{$month}/{$prefix}{$itemid}.{$file_ext}', 'page'=>'{$year}{$month}/{$prefix}{$itemid}_{$page}.{$file_ext}'); $urls['php']['list'][0] = array('example'=>'('.$L['url_php'].') list.php?catid=1&page=2','index'=>'list.php?catid={$catid}', 'page'=>'list.php?catid={$catid}&page={$page}');
$urls['php']['list'][1] = array('example'=>'('.$L['url_php'].') list.php/catid-1-page-2/','index'=>'list.php/catid-{$catid}/', 'page'=>'list.php/catid-{$catid}-page-{$page}/');
$urls['php']['list'][2] = array('example'=>'('.$L['url_rewrite'].') list-htm-catid-1-page-2.html','index'=>'list-htm-catid-{$catid}.html', 'page'=>'list-htm-catid-{$catid}-page-{$page}.html');
$urls['php']['list'][3] = array('example'=>'('.$L['url_rewrite'].') list-1-2.html','index'=>'list-{$catid}.html', 'page'=>'list-{$catid}-{$page}.html');
$urls['php']['list'][4] = array('example'=>'('.$L['url_rewrite'].') list/1/','index'=>'list/{$catid}/', 'page'=>'list/{$catid}/{$page}/');
$urls['php']['list'][5] = array('example'=>'('.$L['url_rewrite'].') mulu-c1-2.html','index'=>'{$catdir}-c{$catid}-1.html', 'page'=>'{$catdir}-c{$catid}-{$page}.html'); $urls['php']['item'][0] = array('example'=>'('.$L['url_php'].') show.php?itemid=1&page=2','index'=>'show.php?itemid={$itemid}', 'page'=>'show.php?itemid={$itemid}&page={$page}');
$urls['php']['item'][1] = array('example'=>'('.$L['url_php'].') show.php/itemid-1-page-2/','index'=>'show.php/itemid-{$itemid}/', 'page'=>'show.php/itemid-{$itemid}-page-{$page}/');
$urls['php']['item'][2] = array('example'=>'('.$L['url_rewrite'].') show-htm-itmeid-1.html','index'=>'show-htm-itemid-{$itemid}.html', 'page'=>'show-htm-itemid-{$itemid}-page-{$page}.html');
$urls['php']['item'][3] = array('example'=>'('.$L['url_rewrite'].') show-1-2.html','index'=>'show-{$itemid}.html', 'page'=>'show-{$itemid}-{$page}.html');
$urls['php']['item'][4] = array('example'=>'('.$L['url_rewrite'].') show/1/','index'=>'show/{$itemid}/', 'page'=>'show/{$itemid}/{$page}/');
?>

  7.0伪静态规则

# xuetong365 Rewrite Rules
ErrorDocument 404 /404.php
RewriteEngine On
RewriteRule ^(.*)\.(asp|aspx|asa|asax|dll|jsp|cgi|fcgi|pl)(.*)$ /404.php
RewriteRule ^(admin|cache|file|include|lang|module|skin|template|skin)/(.*)\.php(.*)$ /404.php
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)/show-([0-9]+)([\-])?([0-9]+)?\.html$ $1/show.php?itemid=$2&page=$4
RewriteRule ^(.*)/list-([0-9]+)([\-])?([0-9]+)?\.html$ $1/list.php?catid=$2&page=$4
RewriteRule ^(.*)/([A-za-z0-9_\-]+)-c([0-9]+)-([0-9]+)\.html$ $1/list.php?catid=$3&catdir=$2&page=$4
RewriteRule ^(.*)/show/([0-9]+)/([0-9]+)?([/])?$ $1/show.php?itemid=$2&page=$3
RewriteRule ^(.*)/list/([0-9]+)/([0-9]+)?([/])?$ $1/list.php?catid=$2&page=$3
RewriteRule ^(.*)/([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/index.php?moduleid=$2&catid=$3&itemid=$4&page=$5
RewriteRule ^(.*)/([a-z]+)/(.*)\.shtml$ $1/$2/index.php?rewrite=$3
RewriteRule ^(com)/([a-z0-9_\-]+)/([a-z]+)/(.*)\.html$ index.php?homepage=$2&file=$3&rewrite=$4
RewriteRule ^(com)/([a-z0-9_\-]+)/([a-z]+)([/])?$ index.php?homepage=$2&file=$3
RewriteRule ^(com)/([a-z0-9_\-]+)([/])?$ index.php?homepage=$2
RewriteRule ^(.*)/search-htm-kw-([A-za-z0-9]+)\.html$ $1/search.php?kw=$2

  演示站点:http://www.xuetong365.com/

dt二次开发之-url伪静态的自定义的更多相关文章

  1. dt二次开发之-地区链接伪静态标签用法

    用法:开启伪静态功能,参照前台,看看哪里有按照地区浏览,然后打开对应的模块和模板,修改 <a href="{$MOD[linkurl]}search.php?areaid={$v[ar ...

  2. DT二次开发之-采购页面加入好看的倒计时

    加入采购页面倒计时,个人感觉挺漂亮的,做下笔记. <span id="timer" ></span> {if $totime} <script typ ...

  3. DT二次开发之-资讯列表中调用 TAG 关键词

    资讯列表加文章关键词:(列表或搜索主字段加上 ,tag) {if $t[tag]} <p class="key"> 关键词: {php $tag = str_repla ...

  4. PHPCMS二次开发教程(转)

    转自:http://www.cnblogs.com/semcoding/p/3347600.html PHPCMS V9 结构设计 根目录 |–api  结构文件目录 |–caches 缓存文件目录 ...

  5. PHPCMS二次开发教程

    PHPCMS V9 结构设计 根目录|–api  结构文件目录|–caches 缓存文件目录   |– configs 系统配置文件目录   |– caches_* 系统缓存目录|–phpcms  p ...

  6. Dokuwiki 二次开发记录

    Dokuwiki 二次开发记录 [转]http://www.syyong.com/other/Dokuwiki-Secondary-Development-Record.html DokuWiki 是 ...

  7. destoon二次开发基础代码

    标签调用规则 http://help.destoon.com/develop/22.html 数据字典 http://help.destoon.com/dict.php destoon各类调用汇总 h ...

  8. PHP二次开发discuz3.2最新体验

    康盛官方于6月4号发布了discuz3.2的正式版,因为这两天一直忙于一个项目,一直没来的及体验,现在抽时间总算是装上了,也体验一把. 根据官方说明:Discuz! X3.2 在继承和完善 Discu ...

  9. SilverlightOA源代码(可用于企业级Silverlight项目的二次开发,长年有效)

    Silverlight OA系统简介 系统功能简介 l 程序界面介绍: 左侧为主菜单,主菜单可以展开和收起,主菜单下面的所有模块都可以在数据库中扩展增加,模块的权限和用户角色挂钩,可以在数据库中创建多 ...

随机推荐

  1. Hibernate-validator数据验证

    前言 数据效验工作在开发工作中,是非常重要的,保证数据的正确性,可靠性,安全性.不仅在前端进行效验,还要在后台继续进行效验. 前端做验证只是为了用户体验,比如控制按钮的显示隐藏,单页应用的路由跳转等等 ...

  2. Java doc注释

    常用Java注释标签(Java comment tags) @author 作者 适用范围:文件.类.方法 (多个作者使用多个@author标签标识,java doc中显示按输入时间顺序罗列.) 例: ...

  3. [LOJ2537] [PKUWC2018] Minimax

    题目链接 LOJ:https://loj.ac/problem/2537 洛谷:https://www.luogu.org/problemnew/show/P5298 Solution 不定期诈尸 好 ...

  4. CF627E Orchestra [矩阵计数]

    也许更好的阅读体验 \(\mathcal{Description}\) 题目大意 有一个\(r * c\)的矩阵上有\(n\)个点,问有多少个子矩阵里包含至少\(k\)个点 输入格式 第一行四个数\( ...

  5. java之struts2之文件上传

    1.在大多数应用中,都有文件上传功能.有两种文件上传的方式,一种是自己去解析http协议,获取文件上传的内容.另一种是通过第三方插件来实现文件上传.第三方插件一般有两种,smartfileupload ...

  6. matlab安装与使用

    Matlab安装和使用 百度网盘连接:https://pan.baidu.com/s/1aHPeAkNofCuwyYopnva4Mg 提取码:ci96 下载完成后: 将R2017b_win64_dvd ...

  7. Autofac在.NetCore 下的使用

    在工作开发中很多地方都会使用到接口模式开发,这里就会用到依赖注入,.NetCore目前是自带的 ,在 Startup.cs中的 ConfigureServices方法中增加 public void C ...

  8. serviceBehaviors_dataContractSerializer_maxItemsInObjectGraph 关键**Behavior

    <behaviors> <serviceBehaviors> <behavior name="STHotel.Product.WCFService.HotelP ...

  9. stack + positioned

    stack 下套container, 发现最大的显示,小的都没显示, 把所有都套个POSITIONED, 都正常显示了.

  10. CSS的基本知识

    与HTML相同,CSS也是一种标识语言,即可以在任何文本编辑器中打开和修改 CSS的基本结构 选择器(Selector) 选择器告诉浏览器该样式将会作用于哪些对象,这些对象可以是某个标签.某个对象.网 ...