织梦顶级栏目链接,名称及id调用代码
1 |
{dede:field.typeid function = "gettoptype(@me,typename)" /} //名称 |
|
1 |
{dede:field.typeid function = "gettoptype(@me,typeurl)" /}//链接 |
|
修改 include/helpers/extend.helper.php
结尾增加 :
04 |
* @param string $tid 栏目 id |
05 |
* @param string $field栏目字段 |
08 |
if ( ! function_exists( 'getToptype' )) |
10 |
function getToptype($tid,$field) |
13 |
if (!is_array($cfg_Cs)) |
15 |
require_once(DEDEDATA. "/cache/inc_catalog_base.inc" ); |
17 |
if (!isset($cfg_Cs[$tid][0]) || $cfg_Cs[$tid][0]==0) |
23 |
$topid = GetTopid($cfg_Cs[$tid][0]); |
25 |
$row = $dsql->GetOne( "SELECT * FROM `dede_arctype` WHERE id=$topid" ); |
26 |
if ($field== 'id' ) return $topid; |
27 |
if ($field== 'typename' ) return $row[ 'typename' ];//栏目名称 |
28 |
if ($field== 'typeurl' ) return GetOneTypeUrlA($row);//栏目链接 |
29 |
if ($field== 'typenamedir' ) return $row[ 'typenamedir' ];//栏目英文名称 |
30 |
if ($field== 'seotitle' ) return $row[ 'seotitle' ];//栏目SEO标题 |
31 |
if ($field== 'description' ) return $row[ 'description' ];//栏目描述 |
32 |
if ($field== 'content' ) return $row[ 'content' ];//栏目内容 |
|