View Single Post
Old 01-18-2008, 07:33 PM   #7 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by sketchMedia View Post
that code snippet can be made shorter i believe:
PHP Code:
ob_start(); 
require 
$template_file
echo 
ob_get_clean(); //(or return) 
ob_get_clean() executes both ob_get_contents() and ob_end_clean() automatically
Thanks! I'll update my code!

UPDATE:
PHP Code:
   // Grab the html files
 
public    function html_grab($html.".html"
    {
         if (    
file_exists($html.".html")       )
      {
             
ob_start();
             include 
$site_path."/html/".$html.".html";
           
$tpl_content_parse =ob_get_clean();

             return 
$tpl_content_parse;
          }
            else die(
"The HTML Document currently does not exist");
        }


// Thus I just use the function e.g. html_grab("header") 
You're more than welcome to update any code that should necessary/helps!
Orc is offline  
Reply With Quote