Hi, I have just finished my latest post on PHP. I was looking for a review from my fellow PHP programmers. Can you please give me a review / comments on the blog post? The post is linked as my latest post, so it shouldnt be a problem for you guys to locate. Anyhows, I will give it here also.. http://loveofphp.com/from-the-author/template-system-complete-tutorial-the-labour-part.html. Please tell me what do you think about this one!! Thanks imphpguru
Why not posting the whole post here? b.t.w for your template class note that this is more beautiful class template { // code } instead of class template ....{ ....//code ....}
Dude.. You have to look at your syntax... Should be more like function template($template_file,$template_vars= array(),$template_path=""){ $this->contents = $this->getTemplate($template_file,$template_path); $this->template_vars = $template_vars; $this->template_path = $template_path; } function getTemplate($template_file,$template_path = ""){ $txt = substr($template_path,strlen($template_path) - 1,1); if(($txt != "/") && ($txt != "\\") && ($txt != "")){ $template_path = $template_path."/"; } // PHP 5 Method if(function_exists("file_get_contents")){ $full_path = $template_path.$template_file; $contents = @file_get_contents($full_path); }else{ // Traditional Method $f = fopen($template_file,"r"); $contents = fread($f,filesize($template_file)); } return $contents; } PHP: Your code is well-described, so it's only the syntax you gotta look at
Hi, Yeah I am working on a more PEARy version of it.. but I have had a habit of writing code this ways... Am improving. This was written about 4 months ago . Also, putting the post here... once again.. google duplicate content . Thanks imphpguru .