feulf / raintpl

Easy Php Template Engine
https://feulf.github.io/raintpl
188 stars 47 forks source link

patch for use Iterator #11

Closed alex-arhat closed 13 years ago

alex-arhat commented 13 years ago

add support Iterator interface for foreach

feulf commented 13 years ago

Hey Lazyal could you explain what's the purpose of Iterator there? Thanks

alex-arhat commented 13 years ago

Sorry, did not see your patch earlier

feulf commented 13 years ago

I think we didn't pull this request, right? Can you explain me how this works and for what it is useful, I'm very interested in it! Thanks

alex-arhat commented 13 years ago

//loop code $compiled_code .= "<?php $counter=-1; if( isset($var) && ($var instanceof Iterator || is_array($var) && sizeof($var)) ) foreach( $var as $key => $value ){ $counter++; ?>";