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

42 lines
1.3KB

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