|
写法如下:
- /**
- * 获取顶级栏目名
- * {dede:field name='typeid' function="GetTopTypename(@me)" /}
- **/
- function GetTopTypename($id)
- {
- global $dsql;
- $row = $dsql->GetOne("SELECT typename,topid FROM dede_arctype WHERE id= $id");
- if ($row['topid'] == '0')
- {
- return $row['typename'];
- } else {
- $row1 = $dsql->GetOne("SELECT typename FROM dede_arctype WHERE id= $row[topid]");
- return $row1['typename'];
- }
- }
-
-
- /**
- * 获取顶级栏目英文
- * {dede:field name='typeid' function="GetTopTypeEnName(@me)" /}
- **/
- function GetTopTypeEnName($id)
- {
- global $dsql;
- $row = $dsql->GetOne("SELECT typedir,topid FROM dede_arctype WHERE id= $id");
- if ($row['topid'] == '0')
- {
- $en = $row['typedir'];
-
- } else {
- $row1 = $dsql->GetOne("SELECT typedir FROM dede_arctype WHERE id= $row[topid]");
-
- $en = $row1['typedir'];
- }
- $l=split("/", $en);
- $en=array_pop($l);
- return strtolower($en);
- }
复制代码
写到 \include\common.func.php 最后
|
|