I am writing my own Joomla component (MVC), its based heavily on the newsflash module, because I want to display the latest 5 content items in a sliding tabbed interface, all the hard work is done, but I am having real difficult getting content out of the for loop.
Here is the code I have so far default.php
<ul id="handles" class="tabs">
<?php for ($i = 0, $n = count($list); $i < $n; $i ++) :
modSankeSlideHelper::getTabs($list[$i]);
endfor; ?>
<li class="end"></li>
</ul>
helper.php
function getTabs(&$item)
{
global $mainframe;
$item->created = $item->created;
list($year, $month, $day) = split("-", $item->created);
$tabdate = date('d\/m\/y', mktime(0, 0, 0, $month, $day, $year));
require(JModuleHelper::getLayoutPath('mod_sankeslide', '_tab'));
}
_tab.php
<li><a href="#tab"><span><?php echo 'Shout ' . $tabdate; ?></span><b></b></a></li>
The first item needs to have different value and a class item added to the a: item, so I need to be able to identify which is the first item and do something during that loop.
I tried to use if $i = 0 else statement in the default.php, but it resulted in a page timeout for some reason!
Any ideas?