Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

PHPTAL_LoopControler Class Reference

List of all members.

Public Member Functions

 PHPTAL_LoopControler (&$context, $data_name, $data)
 index ()
 key ()
 number ()
 even ()
 odd ()
 start ()
 end ()
 isValid ()
 length ()
next ()

Public Attributes

 $_context
 $_data
 $_data_name
 $_iterator
 $_error

Detailed Description

Template loop execution controler.

This object is instantiated by the template on each loop.

LoopControlers accept different types of loop target.

Other types are rejected by the loop controler on runtime producing a TypeError exception.

The loop controler install its iterator under the path "repeat/item" where "item" is the name of the output var (defined in the template).

Thus, the template can access differents methods of the iterator: repeat/someitem/key repeat/someitem/index repeat/someitem/next repeat/someitem/last

If not all of these methods are implemented in iterators, ask iterator maintainers.

Author:
Laurent Bedubourg <laurent.bedubourg@free.fr>

Definition at line 58 of file LoopControler.php.


Constructor & Destructor Documentation

PHPTAL_LoopControler::PHPTAL_LoopControler &$  context,
data_name,
data
 

Controler constructor.

Parameters:
PHPTAL_Context $context The template context.
string $data_name The item data name.
mixed $data Loop resource.

Definition at line 76 of file LoopControler.php.

References data, index(), isValid(), and next().


Member Function Documentation

PHPTAL_LoopControler::end  ) 
 

Return true if at the end of the loop (no more item).

Returns:
boolean

Definition at line 222 of file LoopControler.php.

References length(), and number().

PHPTAL_LoopControler::even  ) 
 

Return true if index is even.

Returns:
boolean

Definition at line 192 of file LoopControler.php.

References odd().

PHPTAL_LoopControler::index  ) 
 

Return current item index.

Returns:
int

Definition at line 158 of file LoopControler.php.

Referenced by number(), odd(), PHPTAL_LoopControler(), and start().

PHPTAL_LoopControler::isValid  ) 
 

Definition at line 227 of file LoopControler.php.

Referenced by PHPTAL_LoopControler().

PHPTAL_LoopControler::key  ) 
 

Return current item key or index for non associative iterators.

Returns:
mixed

Definition at line 168 of file LoopControler.php.

PHPTAL_LoopControler::length  ) 
 

Return the length of the data (total number of iterations).

Returns:
int

Definition at line 237 of file LoopControler.php.

Referenced by end().

& PHPTAL_LoopControler::next  ) 
 

Retrieve next iterator value.

Returns:
mixed

Definition at line 247 of file LoopControler.php.

Referenced by PHPTAL_LoopControler().

PHPTAL_LoopControler::number  ) 
 

Index is in range(0, length-1), the number in in range(1, length).

Returns:
int

Definition at line 182 of file LoopControler.php.

References index().

Referenced by end().

PHPTAL_LoopControler::odd  ) 
 

Return true if index is odd.

Returns:
boolean

Definition at line 202 of file LoopControler.php.

References index().

Referenced by even().

PHPTAL_LoopControler::start  ) 
 

Return true if at the begining of the loop.

Returns:
boolean

Definition at line 212 of file LoopControler.php.

References index().


Member Data Documentation

PHPTAL_LoopControler::$_context
 

Definition at line 60 of file LoopControler.php.

PHPTAL_LoopControler::$_data
 

Definition at line 61 of file LoopControler.php.

PHPTAL_LoopControler::$_data_name
 

Definition at line 62 of file LoopControler.php.

PHPTAL_LoopControler::$_error
 

Definition at line 64 of file LoopControler.php.

PHPTAL_LoopControler::$_iterator
 

Definition at line 63 of file LoopControler.php.


The documentation for this class was generated from the following file:
Generated on Tue Jun 29 23:40:59 2004 for Mediawiki by doxygen 1.3.7