[TYPO3-ect] smartyView with div/lib

Elmar HInz elmar.DOT.hinz at team.MINUS.red.DOT.net
Sat Jan 13 23:43:35 CET 2007


Hi Steffen,

> $this->set(name,value);
> $this->get(name);
> 
> but how can walk through this array like foreach($array as $var=>$val) ?
> 

in PHP5 you simply do: foreach($this as $key => $value){ ... }

Yes, iterating an object, that's the SPL magic. But I haven't proved that
cause I try to keep it PHP 4 compatible.

The PHP 4 compatible version is:

for($this->rewind(); $this->valid(); $this->next()) {
	$key = $this->key();
        $value = $this->current();
        ...
}

That's the way you will find it in my examples.

To iterarte the object from external replace $this with the variable
name of the object i.e. $myList.

Regards

Elmar












More information about the TYPO3-team-extension-coordination mailing list