[eluser]n00bPhpCoder[/eluser]
<?php foreach($articleEntry as $myarticle):?>
<h3><span><?=$myarticle->title;?><br/>(<?=$myarticle->author;?>
on
<?=$myarticle->dateposted;?></span></h3><br/>
<?=auto_link($myarticle->content);?><br/>
<?php endforeach ?><br/>
Hi that is a code from my view. I want to increment a counter on every loop can i do that? It says variable is not defined since variables are passed from controller to view right? Is there a way i can do it like this?
<?php foreach($articleEntry as $myarticle):?>
<?php
if($ctr==5){
?>
HTML Here
<?php
}
?>
<h3><span><?=$myarticle->title;?><br/>(<?=$myarticle->author;?>
on
<?=$myarticle->dateposted;?></span></h3><br/>
<?=auto_link($myarticle->content);?><br/>
<?php
$ctr++;
?>
<?php endforeach ?><br/>
is this possible?