• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

网友原创的PHP模板类代码_php实例

php 搞代码 3年前 (2022-01-26) 15次浏览 已收录 0个评论
 <BR><?php <BR>class Lightpage_Template { <br><br>var $Tpl_Header<i>·本2文来源gaodai$ma#com搞$代*码网2</i><strong>搞gaodaima代码</strong>; <BR>var $Tpl_Footer; <BR>var $Tpl_Parsing; <BR>var $Tpl_Template; <BR>var $Tpl_Dirname; <br><br>var $Tpl_Parse_String; <BR>var $Tpl_Parse_Array; <br><br>var $Tpl_Result; <br><br>function __construct() { <BR>$this->Tpl_Header = NULL; <BR>$this->Tpl_Footer = NULL; <BR>$this->Tpl_Parsing = array(); <BR>$this->Tpl_Template = 'list.html'; <BR>$this->Tpl_ToParse = NULL; <br><br>$this->Tpl_Parse_String = array(); <BR>$this->Tpl_Parse_Array = array(); <br><br>$this->Tpl_Result = NULL; <BR>return true; <BR>} <br><br>function Parse_Template() { <BR>$this->Tpl_Parse_String = array(); <BR>$this->Tpl_Parse_Array = array(); <BR>if($this->Tpl_Header!=NULL) { array_push($this->Tpl_Parse_String,$this->Tpl_Header);array_push($this->Tpl_Parse_Array,'{header}'); } <BR>if($this->Tpl_Footer!=NULL) { array_push($this->Tpl_Parse_String,$this->Tpl_Footer);array_push($this->Tpl_Parse_Array,'{footer}'); } <BR>if(count($this->Tpl_Parsing)!=1) { <BR>foreach($this->Tpl_Parsing as $Tpl_Key => $Tpl_Value) { <BR>array_push($this->Tpl_Parse_String,$Tpl_Value); <BR>array_push($this->Tpl_Parse_Array,'{'.$Tpl_Key.'}'); <BR>} <BR>} <BR>if($this->Tpl_Template!=NULL && $this->Tpl_ToParse==NULL) { <BR>$this->Tpl_ToParse = file_get_contents(root.'./Templates/'.$this->Tpl_Template); <BR>} <BR>$this->Tpl_Result = str_replace($this->Tpl_Parse_Array,$this->Tpl_Parse_String,$this->Tpl_ToParse); <BR>return $this->Tpl_Result; <BR>} <br><br>} <BR>?> <BR>


php模板用法:

 <BR>$Mdl = new Lightpage_Template(); <BR>$Mdl->Tpl_Header = 'zzz'; <BR>$Mdl->Tpl_Footer = ''; <BR>$Mdl->Tpl_Parsing = ''; <BR>$Mdl->Tpl_Template = 'list.html'; <BR>echo $Mdl->Parse_Template(); <BR>

搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:网友原创的PHP模板类代码_php实例
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址