Creating a templating system

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Jim
Forum Contributor
Posts: 238
Joined: Fri Apr 19, 2002 5:26 am
Location: Near Austin, Texas

Creating a templating system

Post by Jim »

Well, I'm trying to create a templating system (and I don't want to use someone else's) but i'm short of ideas on where to start.

What I've don't thus far is write a class DefineTemplate() which is as such:

Code: Select all

function ParseFile($file_name)
	{

		
		$this->read = str_replace("|screenshot|" , "Pantheon" , $this->read);
		$this->read = str_replace("|filesize|" , "Pantheon" , $this->read);
		$this->read = str_replace("|filename|" , "Pantheon" , $this->read);
		$this->read = str_replace("|screenshot|" , "Pantheon" , $this->read);
		$this->read = str_replace("|screenshot|" , "Pantheon" , $this->read);
				
			
	
	}

Basically, adding a key and a value will create a definition for you. The only problem is, some of these values will be SQL queries (some of them will have to be mysql arrays themselves).

What method do you folks think I should use to create a good templating system?
Post Reply