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

64 lines
2.1KB

  1. <?php
  2. /**
  3. * 子栏目调用标签
  4. *
  5. * @version $Id: sonchannel.lib.php 1 9:29 2010年7月6日Z tianya $
  6. * @package DedeBIZ.Taglib
  7. * @copyright Copyright (c) 2020, 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
  23. FROM `#@__arctype` WHERE reid='$typeid' AND ishidden<>1 ORDER BY sortrank ASC LIMIT 0,$row";
  24. //And id<>'$typeid'
  25. $dtp2 = new DedeTagParse();
  26. $dtp2->SetNameSpace("field", "[", "]");
  27. $dtp2->LoadSource($innertext);
  28. $dsql->SetQuery($sql);
  29. $dsql->Execute();
  30. $line = $row;
  31. $GLOBALS['autoindex'] = 0;
  32. $likeType = '';
  33. for ($i = 0; $i < $line; $i++) {
  34. if ($col > 1) $likeType .= "<dl>\r\n";
  35. for ($j = 0; $j < $col; $j++) {
  36. if ($col > 1) $likeType .= "<dd>\r\n";
  37. if ($row = $dsql->GetArray()) {
  38. $row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($row);
  39. if (is_array($dtp2->CTags)) {
  40. foreach ($dtp2->CTags as $tagid => $ctag) {
  41. if (isset($row[$ctag->GetName()])) $dtp2->Assign($tagid, $row[$ctag->GetName()]);
  42. }
  43. }
  44. $likeType .= $dtp2->GetResult();
  45. }
  46. if ($col > 1) $likeType .= "</dd>\r\n";
  47. $GLOBALS['autoindex']++;
  48. } //Loop Col
  49. if ($col > 1) {
  50. $i += $col - 1;
  51. $likeType .= " </dl>\r\n";
  52. }
  53. } //Loop for $i
  54. $dsql->FreeResult();
  55. return $likeType;
  56. }