
-----------------------------------
Aziz
Fri Aug 01, 2008 12:58 pm

Including PHP script in templating system
-----------------------------------
Hey guys. While working on the company website, I've implemented a small menu system. The templates, for example, "about.page.php" are as follows:

{% Title: About}

Some text would go in a paragraph. Along with other HTML elements like:

Lists
Images
etc


The appropriate .page.php file is used to construct a Page class (based on the request url):

class Page
{
	public $title, $body;
	public $sidebar = false;
	
	public function __construct($filename, $replace = NULL)
	{
		$f = fopen($filename, 'rb');
		$body = fread($f, filesize($filename));
		fclose($f);
		
		$title = '';
		$sidebar = false;
		
		preg_match('/{% title: (.+)}/im', $body, $matches);
		if ($matches

However, I may want to include some PHP code on certain pages, like a news feed, etc. What would be the best way to go about this?
