• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

DedeCMS 核心类TypeLink.class.php摘要笔记_php技巧

php 搞代码 4年前 (2022-01-26) 17次浏览 已收录 0个评论

注:’//+’ 表示为本人另外加上的注释
Class TypeLink
{
var $typeDir;
var $dsql;
var $TypeID; //+ 类别ID
var $baseDir; //+ 站点根网址
var $modDir; //+ 模板目录
var $indexUrl; //+ 主页链接地址
var $indexName; //+ 主页链接名
var $TypeInfos; //+ 类目信息
var $SplitSymbol; //+ 栏目位置的间隔符号
var $valuePosition; //+ 主页 > 国内 > 两会动态 > (带连接)
var $valuePositionName; //+ 主页 > 国内 > 两会动态 > (不带连接)
var $OptionArrayList; //+ 类目下拉列表
功能一,获得某类目的链接

 <BR>//获得某分类连接的URL <BR>function GetOneTypeUrl($typeinfos) <BR>{ <BR>return GetTypeUrl(); <BR>} <BR>//获得某个类目的超链接信息 <BR>function GetOneTypeLink($typeinfos) <BR>{ <BR>$typepage = $this->GetOneTypeUrl($typeinfos); <BR>$typelink = "".$typeinfos['typename'].""; <BR>return $typelink; <BR>} <BR>


功能二,获得某类目的链接列表 如:’类目一>类目二>’ 这样的形式。

 <BR>//islink 表示返回的列表是否带连接 <BR>//+ SplitSymbol 栏目位置的间隔符号 dede系统默认为'-' <BR>function GetPositionLink($islink=true) <BR>{ //+ 获得 主页链接名 <BR>$indexpage = "indexUrl."'>".$this->indexName.""; <BR>…… <BR>…… <BR>else <BR>{ <BR>if($islink) <BR>{ <BR>$this->valuePosition = $this->GetOneTypeLink($this->TypeInfos); <BR>if($this->TypeInfos['reid']!=0) <BR>{ <BR>//调用递归逻辑 <BR>$this->LogicGetPosition($this->TypeInfos['reid'],true); <BR>} <BR>$this->valuePosition = $indexpage.$this->SplitSymbol.$this->valuePosition; <BR>return $this->valuePosition.$this->SplitSym<mark>@本文来源gaodaimacom搞#代%码@网-</mark><strong>搞代gaodaima码</strong>bol; <BR>} <BR>else <BR>{ <BR>$this->valuePositionName = $this->TypeInfos['typename']; <BR>if($this->TypeInfos['reid']!=0) <BR>{ <BR>//调用递归逻辑 <BR>$this->LogicGetPosition($this->TypeInfos['reid'],false); <BR>} <BR>return $this->valuePositionName; <BR>} <BR>} <BR>} <BR>//获得某类目的链接列表,递归逻辑部分 <BR>function LogicGetPosition($id,$islink) <BR>{ <BR>$this->dsql->SetQuery(" SQL查询语句 "); <BR>$tinfos = $this->dsql->GetOne(); <BR>if($islink) <BR>{ //+ 列表带连接 <BR>$this->valuePosition = $this->GetOneTypeLink($tinfos).$this->SplitSymbol.$this->valuePosition; <BR>} <BR>else <BR>{ //+ 列表不带连接 <BR>$this->valuePositionName = $tinfos['typename'].$this->SplitSymbol.$this->valuePositionName; <BR>} <BR>if($tinfos['reid']>0) <BR>{ //+ 递归 <BR>$this->LogicGetPosition($tinfos['reid'],$islink); <BR>} <BR>} <BR>


功能三, 获得类别列表 高级搜索功能 即highsearch.php 即要用到此函数

 <BR>//hid 是指默认选中类目,0 表示“请选择类目”或“不限类目” <BR>//oper 是用户允许管理的类目,0 表示所有类目 <BR>//channeltype 是指类目的内容类型,0 表示不限频道 <BR>function GetOptionArray($hid=0,$oper=0,$channeltype=0,$usersg=0) <BR>{ <BR>return $this->GetOptionList($hid,$oper,$channeltype,$usersg); <BR>} <BR>function GetOptionList($hid=0,$oper=0,$channeltype=0,$usersg=0) <BR>{ <BR>return $this->OptionArrayList; <BR>} <BR>//+ 为下级类目递归加上 '-' <BR>function LogicGetOptionArray($id, $step, $oper=0) <BR>{ <BR>} <BR>


功能四,
//获得与该类相关的类目,本函数应用于模板标记{dede:channel}{/dede:channel}中
//$typetype 的值为: sun 下级分类 self 同级分类 top 顶级分类

 <BR>function GetChannelList($typeid=0,$reid=0,$row=8,$typetype='sun',$innertext='', <BR>$col=1,$tablewidth=100,$myinnertext='') <BR>{ <BR>} <BR>} <BR>

搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:DedeCMS 核心类TypeLink.class.php摘要笔记_php技巧
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址