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

41 lines
1.3KB

  1. <?php
  2. if (!defined('DEDEINC')) exit('dedebiz');
  3. /**
  4. * 站内新闻调用标签
  5. *
  6. * @version $Id:mynews.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_mynews(&$ctag, &$refObj)
  13. {
  14. global $dsql, $envs;
  15. //属性处理
  16. $attlist = "row|1,titlelen|24";
  17. FillAttsDefault($ctag->CAttribute->Items, $attlist);
  18. extract($ctag->CAttribute->Items, EXTR_SKIP);
  19. $innertext = trim($ctag->GetInnerText());
  20. if (empty($row)) $row = 1;
  21. if (empty($titlelen)) $titlelen = 30;
  22. if (empty($innertext)) $innertext = GetSysTemplets('mynews.htm');
  23. $idsql = '';
  24. if ($envs['typeid'] > 0) $idsql = " WHERE typeid='".GetTopid($this->TypeID)."' ";
  25. $dsql->SetQuery("SELECT * FROM #@__mynews $idsql ORDER BY senddate DESC LIMIT 0,$row");
  26. $dsql->Execute();
  27. $ctp = new DedeTagParse();
  28. $ctp->SetNameSpace('field', '[', ']');
  29. $ctp->LoadSource($innertext);
  30. $revalue = '';
  31. while ($row = $dsql->GetArray()) {
  32. foreach ($ctp->CTags as $tagid => $ctag) {
  33. @$ctp->Assign($tagid, $row[$ctag->GetName()]);
  34. }
  35. $revalue .= $ctp->GetResult();
  36. }
  37. return $revalue;
  38. }