国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
3.5KB

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