国内流行的内容管理系统(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.

81 lines
3.8KB

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