在这篇文章中,我们将带领您了解织梦dedeCMS使用拼音首字母做栏目名称的全貌,同时,我们还将为您介绍有关DEDECMS使用拼音首字母做栏目名称、dedecms织梦子栏目获取顶级栏目名称及链接url办
在这篇文章中,我们将带领您了解织梦dedeCMS使用拼音首字母做栏目名称的全貌,同时,我们还将为您介绍有关DEDECMS使用拼音首字母做栏目名称、dedecms织梦子栏目获取顶级栏目名称及链接url办法、dedecms织梦子栏目获取顶级栏目名称及链接url方法、dedecms织梦获得首字母或拼音的方法,并实现文章列表按首字母归类的知识,以帮助您更好地理解这个主题。
本文目录一览:- 织梦dedeCMS使用拼音首字母做栏目名称
- DEDECMS使用拼音首字母做栏目名称
- dedecms织梦子栏目获取顶级栏目名称及链接url办法
- dedecms织梦子栏目获取顶级栏目名称及链接url方法
- dedecms织梦获得首字母或拼音的方法,并实现文章列表按首字母归类
织梦dedeCMS使用拼音首字母做栏目名称
织梦默认使用拼音为保存目录的时候使用的是中文全拼,当遇到栏目名称比较长的时候目录名称看起来有点冗长,这时候大多数网站管理员喜欢使用拼音首字母作为栏目的保存目录,那么就需要修改dede/cata日志.add.php文件85行 $toptypedir = GetPinyin(stripslashes($toptypename));
修改为 $toptypedir = GetPinyin(stripslashes($toptypename),1);
108 行 $typedir = $toptypedir.'/'.GetPinyin(stripslashes($v));
修改为 $typedir = $toptypedir.'/'.GetPinyin(stripslashes($v),1);
134行 $toptypedir = GetPinyin(stripslashes($toptypename));
修改为 $toptypedir = GetPinyin(stripslashes($toptypename),1);
187行 $typedir = GetPinyin(stripslashes($typename));
修改为 $typedir = GetPinyin(stripslashes($typename),1);
修改完成后赶快保存去试试吧,是不是很简单呢? 本文章网址:http://www.ppssdd.com/code/13246.html。转载请保留出处,谢谢合作!
DEDECMS使用拼音首字母做栏目名称
织梦默认使用拼音为保存目录的时候使用的是中文全拼,当遇到栏目名称比较长的时候目录名称看起来有点冗长,这时候大多数站长喜欢使用拼音首字母作为栏目的保存目录,那么就需要修改dede/catalog.add.PHP文件
85行 $toptypedir = GetPinyin(stripslashes($toptypename));
修改为 $toptypedir = GetPinyin(stripslashes($toptypename),1);
108 行 $typedir = $toptypedir.'/'.GetPinyin(stripslashes($v));
$typedir = $toptypedir.'/'.GetPinyin(stripslashes($v),STHeiti;"> 134行 修改为 $toptypedir = GetPinyin(stripslashes($toptypename),STHeiti;"> 187行 $typedir = GetPinyin(stripslashes($typename));
$typedir = GetPinyin(stripslashes($typename),STHeiti;"> 修改完成后赶快保存去试试吧,是不是很简单呢?
dedecms织梦子栏目获取顶级栏目名称及链接url办法
打开include/helpers/extend.helper.php,添加一个函数:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//织梦58源码收集资源
/**
* 获取指定栏目id的优质栏目的名称
*
* @return string
*/
if ( ! function_exists('getTopChannelName'))
{
function getTopChannelName($id) {
global $dsql;
$typeinfo = $dsql->GetOne("SELECT * FROM `dede_arctype` WHERE id='{$id}'");
if($typeinfo['reid']==0) return $typeinfo['typename'];
else return getTopChannelName($typeinfo['reid']);
}
}
在栏目页这么使用:{dede:field name='id' function='getTopChannelName(@me)'/}
在内容详细页这么使用:{dede:field name='typeid' function='getTopChannelName(@me)'/}
附带获取优质栏目的url:
打开include/helpers/extend.helper.php,添加一个函数:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//织梦58源码收集资源
/**
* 获取指定栏目id的优质栏目的url
*
* @return string
*/
if ( ! function_exists('getTopChannelUrl'))
{
function getTopChannelUrl($id) {
global $dsql;
$typeinfo = $dsql->GetOne("SELECT * FROM `dede_arctype` WHERE id='{$id}'");
if($typeinfo['reid']==0) return GetOneTypeUrlA($typeinfo);
else return getTopChannelUrl($typeinfo['reid']);
}
}
在栏目页这么使用:{dede:field name='id' function='getTopChannelUrl (@me)'/}
在内容详细页这么使用:{dede:field name='typeid' function='getTopChannelUrl(@me)'/}
本文章网址:http://www.ppssdd.com/code/12090.html。转载请保留出处,谢谢合作!dedecms织梦子栏目获取顶级栏目名称及链接url方法
打开include/helpers/extend.helper.PHP,添加一个函数:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
//织梦58模板收集资源
/**
* 获取指定栏目id的顶级栏目的名称
*
* @return string
*/
if ( ! function_exists('getTopChannelName'))
{
function getTopChannelName($id) {
global $dsql;
$typeinfo = $dsql->Getone("SELECT * FROM `dede_arctype` WHERE id='{$id}'");
if($typeinfo['reid']==0) return $typeinfo['typename'];
else return getTopChannelName($typeinfo['reid']);
}
}
|
在列表页这么使用:{dede:field name='id' function='getTopChannelName(@me)'/}
在内容页这么使用:{dede:field name='typeid' function='getTopChannelName(@me)'/}
附带获取顶级栏目的url:
打开include/helpers/extend.helper.PHP,添加一个函数:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
//织梦58模板收集资源
/**
* 获取指定栏目id的顶级栏目的url
*
* @return string
*/
if ( ! function_exists('getTopChannelUrl'))
{
function getTopChannelUrl($id) {
global $dsql;
$typeinfo = $dsql->Getone("SELECT * FROM `dede_arctype` WHERE id='{$id}'");
if($typeinfo['reid']==0) return GetoneTypeUrlA($typeinfo);
else return getTopChannelUrl($typeinfo['reid']);
}
}
|
在列表页这么使用:{dede:field name='id' function='getTopChannelUrl (@me)'/}
在内容页这么使用:{dede:field name='typeid' function='getTopChannelUrl(@me)'/}
dedecms织梦获得首字母或拼音的方法,并实现文章列表按首字母归类
方法一,织梦默认有这个函数,在include/inc/inc_fun_funAdmin.PHP中.即SpGetPinyin()
但他只能得到全拼,没法得到首字母,
用法举例
$pingyin=GetPinyin($row['title'],1); $a=substr(GetPinyin($row['title']),1);//得到拼音首字母 |
if (ord($row['title'])>128) { //汉字开头 $letter=getfirstchar2($row['title']); }else if(ord($row['title'])>=48 and ord($row['title'])<=57){ //数字开头 $letter=iconv_substr($title,1,'utf-8'); }else if(ord($row['title'])>=65 and ord($row['title'])<=90){ //大写英文开头 $letter=iconv_substr($row['title'],'utf-8'); }else if(ord($row['title'])>=97 and ord($row['title'])<=122){ //小写英文开头 $letter=iconv_substr($row['title'],'utf-8'); $letter=strtoupper($letter);//字母转换成大写 } print_r($letter);exit; function getfirstchar2($s0){ $s=iconv("UTF-8","gb2312",$s0); $asc=ord($s{0})*256+ord($s{1})-65536; if($asc>=-20319 and $asc<=-20284)return "A"; if($asc>=-20283 and $asc<=-19776)return "B"; if($asc>=-19775 and $asc<=-19219)return "C"; if($asc>=-19218 and $asc<=-18711)return "D"; if($asc>=-18710 and $asc<=-18527)return "E"; if($asc>=-18526 and $asc<=-18240)return "F"; if($asc>=-18239 and $asc<=-17923)return "G"; if($asc>=-17922 and $asc<=-17418)return "H"; if($asc>=-17417 and $asc<=-16475)return "J"; if($asc>=-16474 and $asc<=-16213)return "K"; if($asc>=-16212 and $asc<=-15641)return "L"; if($asc>=-15640 and $asc<=-15166)return "M"; if($asc>=-15165 and $asc<=-14923)return "N"; if($asc>=-14922 and $asc<=-14915)return "O"; if($asc>=-14914 and $asc<=-14631)return "P"; if($asc>=-14630 and $asc<=-14150)return "Q"; if($asc>=-14149 and $asc<=-14091)return "R"; if($asc>=-14090 and $asc<=-13319)return "S"; if($asc>=-13318 and $asc<=-12839)return "T"; if($asc>=-12838 and $asc<=-12557)return "W"; if($asc>=-12556 and $asc<=-11848)return "X"; if($asc>=-11847 and $asc<=-11056)return "Y"; if($asc>=-11055 and $asc<=-10247)return "Z"; return false; } |
三,如何实现文章列表中,按首字母进行归类归档排序?下面是完整代码
|
关于织梦dedeCMS使用拼音首字母做栏目名称的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于DEDECMS使用拼音首字母做栏目名称、dedecms织梦子栏目获取顶级栏目名称及链接url办法、dedecms织梦子栏目获取顶级栏目名称及链接url方法、dedecms织梦获得首字母或拼音的方法,并实现文章列表按首字母归类的相关信息,请在本站寻找。
本文标签: