Hi,
Do you want to define PosIsGreaterThan, or call it from PHP code directly instead of from in a template?
If you mean call it from PHP code rather than a template, at the moment you can't - there isn't an API to do it. I was thinking about exposing the current scope - may even have discussed it on the list - but so far that hasn't happened.
But if you want to define PosIsGreaterThan, then do this:
class MyCustomIteratorFunctions implements TemplateIteratorProvider {
protected $iteratorPos;
protected $iteratorTotalItems;
public static function get_template_iterator_variables() {
return array('PosIsGreaterThan');
}
public function iteratorProperties($pos, $totalItems) {
$this->iteratorPos = $pos;
$this->iteratorTotalItems = $totalItems;
}
function PosIsGreaterThan($num) {
return $this->iteratorPos > $num;
}
}
In 2.4 the concept of "object" and "member of collection" were merged together, messily. In 3 we've separated the concepts, hence <% loop %> and <% with %>, etc.