[织梦CMS教程] dede织梦调用顶级栏目名称和URL链接

[复制链接]
查看1840 | 回复11 | 2020-7-9 16:10:14 | 显示全部楼层 |阅读模式
问题: 
  在2级栏目页面单独调用该栏目的顶级栏目名称! 
  方法思路: 
  {dede:type} <a href="[field:typelink /]">[field:typename /]</a>  {/dede:type} 标签的基础上进行修改。   调用方法: {dede:type2} <a href="[field:typelink /]">[field:typename /]</a>  {/dede:type2}   新标签放置位置: \include\taglib\type2.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->TypeLink->TypeInfos['topid']) ? $refObj->TypeLink->TypeInfos['topid'] : $envs['typeid']); //echo "ssssssssss1".$refObj->TypeLink->TypeInfos['topid']; //echo "ssssssssss2".$envs['typeid']; exit;     } //echo "typeid:".$typeid; exit; //lyy 如果topid==0 就是顶级分类,取当前记录 if($refObj->TypeLink->TypeInfos['topid']==0){ $typeid=$refObj->TypeLink->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['typelink'] = 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;     } } ?> 织梦教程网络上有很多,但没有一个像自由织梦(www.freedede.cn)这样教程比较齐全的,现在好了,学习开发使用织梦dedecms系 统不用东奔西跑了,直接来自由织梦就好了,提供织梦cms详细的使用教程和织梦建站教程,包括dedecsm的安装、模板开发教程、安 全配置等,DedeCMS从入门到精通建站就是如此轻松。
回复

使用道具 举报

找食的麻雀粮 | 2021-2-13 21:09:17 | 显示全部楼层
支持悟空源码,越来越好
回复

使用道具 举报

林之秋实 | 2021-3-19 16:57:27 | 显示全部楼层
找了好多地方,终于找到了
回复

使用道具 举报

塞上云烟辣 | 2021-11-26 06:01:19 | 显示全部楼层
悟空源码太厉害,资源真多!
回复

使用道具 举报

们至熟两创 | 2022-2-5 17:23:50 | 显示全部楼层
站长真良心,这么大的资源站都是免费下载
回复

使用道具 举报

123456865 | 2022-8-28 16:28:48 | 显示全部楼层
我是来白嫖资源的!
回复

使用道具 举报

123457660 | 2023-2-9 04:46:20 | 显示全部楼层
找了很多地方都不能下载,终于在悟空源码找到了
回复

使用道具 举报

加油!悟空源码,继续努力!支持你!
回复

使用道具 举报

程狄矢 | 2023-11-16 15:48:46 | 显示全部楼层
资源太多了,准备办个会员
回复

使用道具 举报

123456848 | 2024-3-16 22:56:24 | 显示全部楼层
6666悟空源码资源多!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则