PHP Classes
elePHPant
Icontem

File: listtemplate.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of J.B.  >  Simple Object  >  listtemplate.php  >  Download  
File: listtemplate.php
Role: Auxiliary script
Content type: text/plain
Description: class ListTemplate provides an easy way to display lists of objects, it extends SimpleTemplate and shows yet another use of class SimpleObject
Class: Simple Object
Base class with common variable access functions
Author: By
Last change:
Date: 11 years ago
Size: 540 bytes
 

Contents

Class file image Download
<?php
   
class ListTemplate extends SimpleTemplate {
       
        var
$items; /* SimpleIterator */
       
       
function ListTemplate(&$items) {
           
parent::SimpleTemplate();
           
$this->items =& $items;
        }
       
        function
display($list_template,$item_template) {
           
$items =& $this->items;
           
$items->reset();
            while (
$items->next() ) {
               
$item_tpl =& new SimpleTemplate($items->export());
               
$this->append('list',$item_tpl->fetch($item_template,SO_TEMPLATE_FILE));
            }
            echo
$this->fetch($list_template,SO_TEMPLATE_FILE);
        }
    }
?>