Re: Cleaning up my messy code

From: Date: Mon, 29 Sep 2003 20:11:34 +0000
Subject: Re: Cleaning up my messy code
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-164298@lists.php.net to get a copy of this message
From: "Brent Baisley" <brent@landover.com> > I looked into the templating systems at first, but really wanted to try > what they were doing myself. It ends up being very easy to implement > using output buffering. Just look into the ob_start() command. Here is > an example of how I load a template file into a variable: > ob_start(); > include("templateFile.tpl"); > $tpl_content = ob_get_contents(); > ob_end_clean(); The only "problem" with a method like that is any PHP code in your template file is evaluated. If you're the only one writing template files, you can be careful, but any malicious PHP code that worked it's way into the template could cause trouble. You could just use file_get_contents(). ---John Holmes...

« previous php.general (#164298) next »