首页 > 教程 >
织梦dedecms调用顶级栏目名称和URL链接
2023-02-25教程围观次
简介织梦dedecms调用顶级栏目名称和URL链接。问题:在2级栏目页面单独调用该栏目的顶级栏目名称!方法思路:在{dede:type}[field:typename/]{/dede:type}标签的基础上进行修改。调用方法:{dede:type2}[field:typename/]{/dede:type2}新标签放置位置:includetaglibtype2.lib.php保存为type2.lib.
织梦dedecms调用顶级栏目名称和URL链接。
问题:
在2级栏目页面单独调用该栏目的顶级栏目名称!
方法思路:
在
{dede:type}
<a href="[field:type /]">[field:typename /]</a>
{/dede:type}
标签的基础上进行修改。
调用方法:
{dede:type2}
<a href="[field:type /]">[field:typename /]</a>
{/dede:type2}
新标签放置位置:
includetaglibtype2.lib.php保存为type2.lib.php标签就可以使用<?php/* vim: set expandtab tabstop=4 shiftwidth=4: */// +----------------------------------------------------------------------+// | PHP version 5 |// +----------------------------------------------------------------------+// | Copyright (c) 1997-2004 The PHP Group |// +----------------------------------------------------------------------+// | This source file is subject to version 3.0 of the PHP license, |// | that is bundled with this package in the file LICENSE, and is |// | available through the world-wide-web at the following url: |// | http://www.php.net/license/3_0.txt. |// | If you did not receive a copy of the PHP license and are unable to |// | obtain it through the world-wide-web, please send a note to |// | license@php.net so we can mail you a copy immediately. |// +----------------------------------------------------------------------+// | Authors: Original Author <author@example.com> |// | Your Name <you@example.com> |// +----------------------------------------------------------------------+//// $Id:$if (!defined('DEDEINC')) exit('Request Error!');function lib_type2(&$ctag, &$refObj) { global $dsql, $envs; $attlist = 'typeid|0'; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = trim($ctag->GetInnerText()); if ($typeid == 0) { $typeid = (isset($refObj->Type ->TypeInfos['topid']) ? $refObj->Type ->TypeInfos['topid'] : $envs['typeid']);//echo "ssssssssss1".$refObj->Type ->TypeInfos['topid'];//echo "ssssssssss2".$envs['typeid']; exit; }//echo "typeid:".$typeid; exit;//lyy 如果topid==0 就是顶级分类,取当前记录if($refObj->Type ->TypeInfos['topid']==0){$typeid=$refObj->Type ->TypeInfos['id'];}//echo "typeid:".$typeid; exit; if (empty($typeid)) return ''; $row = $dsql->GetOne("SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `dede_arctype` WHERE id='$typeid'"); if (!is_array($row)) return ''; if (trim($innertext) == '') $innertext = GetSysTemplets("part_type_list.htm"); $dtp = new DedeTagParse(); $dtp->SetNameSpace('field', '[', ']'); $dtp->LoadSource($innertext); if (!is_array($dtp->CTags)) { unset($dtp); return ''; } else {//lyy 以下getTypeUrl($row[topid]错的,换成 $row['id'] echo $row['id']."sssss";exit; $row['type '] = GetTypeUrl($row['id'], MfTypedir($row['typedir']) , $row['isdefault'], $row['defaultname'], $row['ispart'], $row['namerule2'], $row['siteurl'], $row['sitepath']);//print_r($row);exit; foreach ($dtp->CTags as $tagid => $ctag) { if (isset($row[$ctag->GetName() ])) $dtp->Assign($tagid, $row[$ctag->GetName() ]); } $revalue = $dtp->GetResult(); unset($dtp); return $revalue; }} ?> |
下载链接:网站源码/小程序源码/网站模板下载
下载排行
- WordPress主题 JustNews5.2.2 + QAPress问答插件适合源码站虚拟资源站个人博客
- ThinkPHP高仿蓝奏云网盘系统源码/对接易支付系统程序
- 最新JustMedia V2.7.3主题破解版去授权WordPress主题模板
- 最新去水印小程序源码分享/无需后台/对接接口/支持全网去水印功能
- 自带多平台解析接口短视频去水印图集水印小程序源码下载
- TooNaughty网址导航主题/WordPress主题下载
- 最新短视频去水印小程序源码/带流量主/外卖CPS系统/批量解析/修改MD5
- 某鱼最近卖的很火蓝色版微信去水印小程序源码+接口
- 最新版去水印小程序源码/基于WordPress的短视频去水印小程序源码
- 起点导航系统源码最新V2.6开源可运营版