Want to Convert Foreach Loop Into For Loop

i m using Joomla there i have Component named Media Collection in template layout of Component i had an issue regarding

tag that is been generated by Foreach Loop, the placement of Music Albums goes vertical in single column, the required layout needed to be 4 albums in a each row, error is this right now layout have only 1 album in a row…can any one help me with This Php Coding?
Foreach loop
[php] <?php defined('_JEXEC') or die('Restricted access'); $itemid = $this->params->get('itemid'); if($itemid != "") $itemid = "&Itemid=" . $itemid; $image_attr = array( "class" => "image_115_llista" ); $link= JRoute::_( 'index.php?option=com_muscol&view=album&id='. $this->detail_album->id . $itemid); $image = MusColHelper::createThumbnail($this->detail_album->image, $this->detail_album->name, $this->params->get('thumb_size_artist_2'), $image_attr); ?> <?php if(count($this->detail_album->subalbums)){ ?>
             <div class="subalbums">
            foreach($this->detail_album->subalbums as $subalbum) {
                $image_attr = array(
                            "class" => "image_40_llista"
                $link= JRoute::_( 'index.php?option=com_muscol&view=album&id='. $subalbum->id . $itemid);
                $image = MusColHelper::createThumbnail($subalbum->image, $subalbum->name, $this->params->get('thumb_size_artist_1'), $image_attr);
                //$image = JHTML::image('images/albums/thumbs_40/' . $subalbum->image , $subalbum->name , $image_attr );
                <a href='<? echo $link; ?>'><? echo $image; ?></a> 
            <? } ?>
         <? } ?>[/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service