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

55 lines
2.0KB

  1. <?php
  2. /**
  3. * 子栏目标签
  4. *
  5. * @version $id:sonchannel.lib.php 9:29 2010年7月6日 tianya $
  6. * @package DedeBIZ.Taglib
  7. * @copyright Copyright (c) 2022 DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. function lib_sonchannel(&$ctag, &$refObj)
  12. {
  13. global $_sys_globals, $dsql;
  14. $attlist = "row|100,nosonmsg|,col|1";
  15. FillAttsDefault($ctag->CAttribute->Items, $attlist);
  16. extract($ctag->CAttribute->Items, EXTR_SKIP);
  17. $innertext = $ctag->GetInnerText();
  18. $typeid = $_sys_globals['typeid'];
  19. if (empty($typeid)) {
  20. return $ctag->GetAtt('nosonmsg');
  21. }
  22. $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `#@__arctype` WHERE reid='$typeid' AND ishidden<>1 ORDER BY sortrank ASC LIMIT 0,$row";
  23. $dtp2 = new DedeTagParse();
  24. $dtp2->SetNameSpace("field", "[", "]");
  25. $dtp2->LoadSource($innertext);
  26. $dsql->SetQuery($sql);
  27. $dsql->Execute();
  28. $line = $row;
  29. $GLOBALS['autoindex'] = 0;
  30. $likeType = '';
  31. for ($i = 0; $i < $line; $i++) {
  32. if ($col > 1) $likeType .= "<dl>\r\n";
  33. for ($j = 0; $j < $col; $j++) {
  34. if ($col > 1) $likeType .= "<dd>\r\n";
  35. if ($row = $dsql->GetArray()) {
  36. $row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($row);
  37. if (is_array($dtp2->CTags)) {
  38. foreach ($dtp2->CTags as $tagid => $ctag) {
  39. if (isset($row[$ctag->GetName()])) $dtp2->Assign($tagid, $row[$ctag->GetName()]);
  40. }
  41. }
  42. $likeType .= $dtp2->GetResult();
  43. }
  44. if ($col > 1) $likeType .= "</dd>\r\n";
  45. $GLOBALS['autoindex']++;
  46. } //Loop Col
  47. if ($col > 1) {
  48. $i += $col - 1;
  49. $likeType .= "</dl>\r\n";
  50. }
  51. } //Loop for $i
  52. $dsql->FreeResult();
  53. return $likeType;
  54. }
  55. ?>