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

118 line
2.9KB

  1. <?php if (!defined('DEDEINC')) exit("Request Error!");
  2. /**
  3. * 单表模型视图类
  4. *
  5. * @version $Id: arc.sgpage.class.php 1 15:48 2010年7月7日Z tianya $
  6. * @package DedeBIZ.Libraries
  7. * @copyright Copyright (c) 2021, DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. require_once(DEDEINC . "/arc.partview.class.php");
  12. /**
  13. * 单表模型列表视图类
  14. *
  15. * @package SgListView
  16. * @subpackage DedeBIZ.Libraries
  17. * @link https://www.dedebiz.com
  18. */
  19. class sgpage
  20. {
  21. var $dsql;
  22. var $dtp;
  23. var $TypeID;
  24. var $Fields;
  25. var $TypeLink;
  26. var $partView;
  27. /**
  28. * php5构造函数
  29. *
  30. * @access public
  31. * @param int $aid 内容ID
  32. * @return string
  33. */
  34. function __construct($aid)
  35. {
  36. global $cfg_basedir, $cfg_templets_dir, $cfg_df_style, $envs;
  37. $this->dsql = $GLOBALS['dsql'];
  38. $this->dtp = new DedeTagParse();
  39. $this->dtp->refObj = $this;
  40. $this->dtp->SetNameSpace("dede", "{", "}");
  41. $this->Fields = $this->dsql->GetOne("SELECT * FROM `#@__sgpage` WHERE aid='$aid' ");
  42. $envs['aid'] = $this->Fields['aid'];
  43. //设置一些全局参数的值
  44. foreach ($GLOBALS['PubFields'] as $k => $v) {
  45. $this->Fields[$k] = $v;
  46. }
  47. if ($this->Fields['ismake'] == 1) {
  48. $pv = new PartView();
  49. $pv->SetTemplet($this->Fields['body'], 'string');
  50. $this->Fields['body'] = $pv->GetResult();
  51. }
  52. $tplfile = $cfg_basedir . str_replace('{style}', $cfg_templets_dir . '/' . $cfg_df_style, $this->Fields['template']);
  53. $this->dtp->LoadTemplate($tplfile);
  54. $this->ParseTemplet();
  55. }
  56. //php4构造函数
  57. function sgpage($aid)
  58. {
  59. $this->__construct($aid);
  60. }
  61. /**
  62. * 显示内容
  63. *
  64. * @access public
  65. * @return void
  66. */
  67. function Display()
  68. {
  69. $this->dtp->Display();
  70. }
  71. /**
  72. * 获取内容
  73. *
  74. * @access public
  75. * @return void
  76. */
  77. function GetResult()
  78. {
  79. return $this->dtp->GetResult();
  80. }
  81. /**
  82. * 保存结果为文件
  83. *
  84. * @access public
  85. * @return void
  86. */
  87. function SaveToHtml()
  88. {
  89. $filename = $GLOBALS['cfg_basedir'] . $GLOBALS['cfg_cmspath'] . '/' . $this->Fields['filename'];
  90. $filename = preg_replace("/\/{1,}/", '/', $filename);
  91. $this->dtp->SaveTo($filename);
  92. }
  93. /**
  94. * 解析模板里的标签
  95. *
  96. * @access public
  97. * @return string
  98. */
  99. function ParseTemplet()
  100. {
  101. $GLOBALS['envs']['likeid'] = $this->Fields['likeid'];
  102. MakeOneTag($this->dtp, $this);
  103. }
  104. //关闭所占用的资源
  105. function Close()
  106. {
  107. }
  108. }//End Class