creating a templating parser with PHP
Does anybody have experience with creating an own parser in PHP?
I have to create a CMS with a specific templating code.
It is not just find and replace... it's more.
I'll give an example to make it clear.
I have a contenttype "news". There is a page that must show the last 10 newsitems. In the template we can find something like this:
<html>
<body>
<h1>Welcome to the newspage</h1>
<news items="10" order="datedesc" />
</body>
</html>
That's it for the page.
In the configuration of the contenttype news we can configure how an item must appear, a template...
It looks something like this:
<h3>##TITLE##</h3>
<p>##BODY##</p>
As you can see, the title and body field are fields specific for the newsitem. For 1 item i can do a replace on ##TITLE## and ##BODY## but wouldn't that be to intense if i have a lot of fields?
I need some sort of a pattern to create a robust mechanism to create such a templating system.
|