Hi,
I was wondering if it would not be easier for us to create a template class to handle templates:
$tp = new Template('templatefile.tpl.html')
// adding strings
$tp->addContent('content_name','Some content')
// adding other templates
$tp->addContent('other_content',new Template('other_file.tpl.html'))
// now we can add anything to the template
$tp->addContent('whatever_name','whatever_text')
// the final step is to generate and/or display the template
$html = $tp->generate() // returns the contents of the template
or
$tp->display() // sends the content directly to the client
The template would use only html codes and placeholders and not php codes.
e.g.
<html>
<body>
{@content_name}
{@conten_name2}
</body>
</html>
{@content_name} is a placeholder for the missing content.
This would completely separate the php (or Business) logic from the html user interface (UI) design. In my view I think is is much cleaner and easier to maintain. The templates are to be pure html files and can be easily modified with any html editor.
--
Xwisdom




LinkBack URL
About LinkBacks






Bookmarks