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

82 lines
3.3KB

  1. <?php if(!defined('DEDEINC')) exit('Request Error!');
  2. /**
  3. * 动态模板spacenewart标签
  4. *
  5. * @version $Id: plus_spacenewart.php 1 13:58 2010年7月5日Z tianya $
  6. * @package DedeCMS.Tpllib
  7. * @copyright Copyright (c) 2007 - 2020, DesDev, Inc.
  8. * @license http://help.dedecms.com/usersguide/license.html
  9. * @link http://www.dedecms.com
  10. */
  11. function plus_spacenewart(&$atts,&$refObj,&$fields)
  12. {
  13. global $dsql,$_vars;
  14. $attlist = "channel=1,titlelen=30,infolen=200,row=8,imgwidth=120,imgheight=90";
  15. FillAtts($atts,$attlist);
  16. FillFields($atts,$fields,$refObj);
  17. extract($atts, EXTR_OVERWRITE);
  18. $query = "Select arc.*,mt.mtypename,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,
  19. tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath
  20. from `#@__archives` arc
  21. left join `#@__arctype` tp on arc.typeid=tp.id
  22. left join `#@__mtypes` mt on mt.mtypeid=arc.mtype
  23. where arc.mid='{$_vars['mid']}' and arc.channel=$channel
  24. order by id desc limit 0,$row";
  25. $dsql->SetQuery($query);
  26. $dsql->Execute("al");
  27. $artlist = '';
  28. $rearr = array();
  29. while($row = $dsql->GetArray("al"))
  30. {
  31. //处理一些特殊字段
  32. $row['infos'] = cn_substr($row['description'],$infolen);
  33. $row['id'] = $row['id'];
  34. $row['arcurl'] = GetFileUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'],
  35. $row['arcrank'],$row['namerule'],$row['typedir'],$row['money'],$row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']);
  36. $row['typeurl'] = GetTypeUrl($row['typeid'],$row['typedir'],$row['isdefault'],$row['defaultname'],$row['ispart'],
  37. $row['namerule2'],$row['moresite'],$row['siteurl'],$row['sitepath']);
  38. if($row['litpic']=='')
  39. {
  40. $row['litpic'] = '/static/defaultpic.gif';
  41. }
  42. if(!preg_match("#^http:\/\/#i", $row['litpic']))
  43. {
  44. $row['picname'] = $row['litpic'] = $GLOBALS['cfg_cmsurl'].$row['litpic'];
  45. }
  46. else
  47. {
  48. $row['picname'] = $row['litpic'] = $row['litpic'];
  49. }
  50. $row['stime'] = GetDateMK($row['pubdate']);
  51. $row['typelink'] = "<a href='".$row['typeurl']."'>".$row['typename']."</a>";
  52. $row['image'] = "<img src='".$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".preg_replace("#['><]#", "", $row['title'])."'>";
  53. $row['imglink'] = "<a href='".$row['filename']."'>".$row['image']."</a>";
  54. $row['fulltitle'] = $row['title'];
  55. $row['title'] = cn_substr($row['title'],$titlelen);
  56. if($row['color']!='') {
  57. $row['title'] = "<font color='".$row['color']."'>".$row['title']."</font>";
  58. }
  59. if(preg_match('#b#', $row['flag']))
  60. {
  61. $row['title'] = "<strong>".$row['title']."</strong>";
  62. }
  63. //$row['title'] = "<b>".$row['title']."</b>";
  64. $row['textlink'] = "<a href='".$row['filename']."'>".$row['title']."</a>";
  65. $row['plusurl'] = $row['phpurl'] = $GLOBALS['cfg_phpurl'];
  66. $row['memberurl'] = $GLOBALS['cfg_memberurl'];
  67. $row['templeturl'] = $GLOBALS['cfg_templeturl'];
  68. $rearr[] = $row;
  69. }//loop line
  70. $dsql->FreeResult("al");
  71. return $rearr;
  72. }