国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

80 Zeilen
3.5KB

  1. <?php
  2. if (!defined('DEDEINC')) exit('dedebiz');
  3. /**
  4. *
  5. *
  6. * @version $id:cattree.lib.php 9:29 2010年7月6日 tianya $
  7. * @package DedeBIZ.Taglib
  8. * @copyright Copyright (c) 2022 DedeBIZ.COM
  9. * @license https://www.dedebiz.com/license
  10. * @link https://www.dedebiz.com
  11. */
  12. function lib_cattree(&$ctag, &$refObj)
  13. {
  14. global $dsql;
  15. //属性处理showall在空或不存在时,强制用产品模型id;如果是yes刚显示整个语言区栏目树,为其它数字则是这个数字的模型的id;typeid指定顶级树id,指定后,前一个属性无效
  16. $attlist = "showall|,catid|0";
  17. FillAttsDefault($ctag->CAttribute->Items, $attlist);
  18. extract($ctag->CAttribute->Items, EXTR_SKIP);
  19. $revalue = '';
  20. if (empty($typeid)) {
  21. if (isset($refObj->TypeLink->TypeInfos['id'])) {
  22. $typeid = $refObj->TypeLink->TypeInfos['id'];
  23. $reid = $refObj->TypeLink->TypeInfos['reid'];
  24. $topid = $refObj->TypeLink->TypeInfos['topid'];
  25. $channeltype = $refObj->TypeLink->TypeInfos['channeltype'];
  26. $ispart = $refObj->TypeLink->TypeInfos['ispart'];
  27. if ($reid == 0) $topid = $typeid;
  28. } else {
  29. $typeid = $reid = $topid = $channeltype = $ispart = 0;
  30. }
  31. } else {
  32. $row = $dsql->GetOne("SELECT reid,topid,channeltype,ispart FROM `#@__arctype` WHERE id='$typeid' ");
  33. if (!is_array($row)) {
  34. $typeid = $reid = $topid = $channeltype = $ispart = 0;
  35. } else {
  36. $reid = $row['reid'];
  37. $topid = $row['topid'];
  38. $channeltype = $row['channeltype'];
  39. $ispart = $row['ispart'];
  40. }
  41. }
  42. if (!empty($catid)) {
  43. $topQuery = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `#@__arctype` WHERE reid='$catid' And ishidden<>1 ";
  44. } else {
  45. if ($showall == "yes") {
  46. $topQuery = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `#@__arctype` WHERE reid='$topid' ";
  47. } else {
  48. if ($showall == '') {
  49. if ($ispart < 2 && !empty($channeltype)) $showall = $channeltype;
  50. else $showall = 6;
  51. }
  52. $topQuery = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `#@__arctype` WHERE reid='{$topid}' And channeltype='{$showall}' And ispart<2 And ishidden<>1 ";
  53. }
  54. }
  55. $dsql->Execute('t', $topQuery);
  56. while ($row = $dsql->GetArray('t')) {
  57. $row['typelink'] = GetOneTypeUrlA($row);
  58. $revalue .= "<dl class='cattree'>\n";
  59. $revalue .= "<dt><a href='{$row['typelink']}'>{$row['typename']}</a></dt>\n";
  60. cattreeListSon($row['id'], $revalue);
  61. $revalue .= "</dl>\n";
  62. }
  63. return $revalue;
  64. }
  65. function cattreeListSon($id, &$revalue)
  66. {
  67. global $dsql;
  68. $query = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `#@__arctype` WHERE reid='{$id}' And ishidden<>1 ";
  69. $dsql->Execute($id, $query);
  70. $thisv = '';
  71. while ($row = $dsql->GetArray($id)) {
  72. $row['typelink'] = GetOneTypeUrlA($row);
  73. $thisv .= "<dl class='cattree'>\n";
  74. $thisv .= "<dt><a href='{$row['typelink']}'>{$row['typename']}</a></dt>\n";
  75. cattreeListSon($row['id'], $thisv);
  76. $thisv .= "</dl>\n";
  77. }
  78. if ($thisv != '') $revalue .= "<dd>\n$thisv</dd>\n";
  79. }
  80. ?>