Hi gang, I am having a problem with how I should go about templates. I am not sure if my approach is a very good one considering its disadvanatges, so please have a look.

here we go, the way I do it now. In order to require as little php knowledge as possible from the designer I even factor out very little template bits into their own files.

Have a look at this code:

PHP Code:
private function issueArchive() {  
// fetch the issues from the collection and build
        // html with them

        while ( 
$issue=$this->issueCollection->fetch() ) {            
$issueRow =& new Template('issue_row'); 
$issueRow->setValue('{DATE}',date('F d, Y'$issue->getDate() ));
$rows[] = $issueRow->fetch();
// Alternating Row Color Support
$rowColorer=& new AlternatingRowColorer($rows'{ROW_COLOR_CLASS}''row1''row2');
// convert the rows to a string
$conv=& new ArrayToStringConverter($rows);
// acquire heading, etc - build the page
if(count($rows) > 0) {
// Get heading
$heading =& new Template('issue_list_heading');
$heading->setValue('{TEXT}','Community Crier Archive');
$heading $heading->fetch();
$archive =& new Template('issue_list');           
        } else {
$archive =& new Template('error_page');
$archive->setValue('{TITLE}','Error Title');
$archive->setValue('{CONTENT}','Sorry, there are no issues yet!');
Should be self-explaining, if not, please ask.

This is what the issue_row template file includes:

<li>Issue from <a href="index.php?page=view_issue&amp;id={ID}">{DATE}</a></li>
This is what the template file 'issue_list' includes:

<ul class="archive_list">
Okay what does that tell us? The presentation is greatly outsourced into files. The designers won't have to deal with any php code or code of another scripting language (other than Javascript if they want to use it - the php coder doesn't care).

Problem: He has to mess with HUNDREDS of files. Basically whenever I use a list of things I create a separate ****_list file template, that contains '<li>{VAR]</li>' or something. Now that is not very cool. The question is how can I mainatain all this decoupling while storing more template information in the different files? Sounds like using functions, but then again this would mean adding php code to the scripts. Any ideas here?