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

56 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. //And id<>'$typeid'
  24. $dtp2 = new DedeTagParse();
  25. $dtp2->SetNameSpace("field", "[", "]");
  26. $dtp2->LoadSource($innertext);
  27. $dsql->SetQuery($sql);
  28. $dsql->Execute();
  29. $line = $row;
  30. $GLOBALS['autoindex'] = 0;
  31. $likeType = '';
  32. for ($i = 0; $i < $line; $i++) {
  33. if ($col > 1) $likeType .= "<dl>\r\n";
  34. for ($j = 0; $j < $col; $j++) {
  35. if ($col > 1) $likeType .= "<dd>\r\n";
  36. if ($row = $dsql->GetArray()) {
  37. $row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($row);
  38. if (is_array($dtp2->CTags)) {
  39. foreach ($dtp2->CTags as $tagid => $ctag) {
  40. if (isset($row[$ctag->GetName()])) $dtp2->Assign($tagid, $row[$ctag->GetName()]);
  41. }
  42. }
  43. $likeType .= $dtp2->GetResult();
  44. }
  45. if ($col > 1) $likeType .= "</dd>\r\n";
  46. $GLOBALS['autoindex']++;
  47. } //Loop Col
  48. if ($col > 1) {
  49. $i += $col - 1;
  50. $likeType .= " </dl>\r\n";
  51. }
  52. } //Loop for $i
  53. $dsql->FreeResult();
  54. return $likeType;
  55. }
  56. ?>