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

68 lines
2.1KB

  1. <?php
  2. /**
  3. * 子栏目调用标签
  4. *
  5. * @version $Id: sonchannel.lib.php 1 9:29 2010年7月6日Z tianya $
  6. * @package DedeCMS.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. {
  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. {
  36. if($col>1) $likeType .= "<dl>\r\n";
  37. for($j=0;$j<$col;$j++)
  38. {
  39. if($col>1) $likeType .= "<dd>\r\n";
  40. if($row=$dsql->GetArray())
  41. {
  42. $row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($row);
  43. if(is_array($dtp2->CTags))
  44. {
  45. foreach($dtp2->CTags as $tagid=>$ctag){
  46. if(isset($row[$ctag->GetName()])) $dtp2->Assign($tagid,$row[$ctag->GetName()]);
  47. }
  48. }
  49. $likeType .= $dtp2->GetResult();
  50. }
  51. if($col>1) $likeType .= "</dd>\r\n";
  52. $GLOBALS['autoindex']++;
  53. }//Loop Col
  54. if($col>1)
  55. {
  56. $i += $col - 1;
  57. $likeType .= " </dl>\r\n";
  58. }
  59. }//Loop for $i
  60. $dsql->FreeResult();
  61. return $likeType;
  62. }