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

62 lines
2.1KB

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