...

View Full Version : customizing look of content in foreach tags...



nando99
07-08-2007, 10:00 PM
my php knowledge is so so - please be gentle..lol

i'm working on http://www.aydoubleyou.com/UPLOAD/

its running the MSLS script from myspacepros.

as you can see, its duplicating the layouts on the index page - unfortunately, it looks how I want it to look..lol.. 1 layout grey, 1 layout white... but i can't figure out how to do it with out duplicating the layout...

heres the code for 1 layout



<?php foreach($latestlayouts->results as $layout) : ?>
<?php if(isset($layout->ad)): ?>
<?php else : ?>
<tr><td>
<div class="list_layout_color"><table width="80%" cellpadding="5">
<tr>
<td width="50%" align="center" valign="top">
<img title="cssbody=[bigimage] header=[] body=[<img src='<?=$layout->thumb_large?>' />]" class="" src="<?=$layout->thumb_small?>" border="1"/></td>
<td width="50%" valign="top"><p class="list_title"><?=$layout->name?></p>
<p class="list_date">Added on <?=$layout->date->month->long?> <?=$layout->date->day->number?>, <?=$layout->date->year->long?> <?=$layout->date->time->hour?>:<?=$layout->date->time->min?> <?=$layout->date->time->meridiem?></p>
<p class="list_views"><?=$layout->views?> Views - <?=$layout->downloads?> Downloadeds</p>
<p class="list_link_view"><a href="<?=$layout->preview_link?>">Preview</a> - <a href="<?=$layout->download_link?>">Download</a></p>
</td>
</tr>
</table></div>
</td></tr>

<?php endif; ?>

<?php endforeach; ?>


heres what i'm using to switch the colors - which is also duplicating the layouts - i know why its duplicating - but its the only i can get grey. white, grey, white..etc...



<?php foreach($latestlayouts->results as $layout) : ?>

<?php if(isset($layout->ad)): ?>
<?php else : ?>
<tr><td>
<div class="list_layout_color"><table width="80%" cellpadding="5">
<tr>
<td width="50%" align="center" valign="top">
<img title="cssbody=[bigimage] header=[] body=[<img src='<?=$layout->thumb_large?>' />]" class="" src="<?=$layout->thumb_small?>" border="1"/></td>
<td width="50%" valign="top"><p class="list_title"><?=$layout->name?></p>
<p class="list_date">Added on <?=$layout->date->month->long?> <?=$layout->date->day->number?>, <?=$layout->date->year->long?> <?=$layout->date->time->hour?>:<?=$layout->date->time->min?> <?=$layout->date->time->meridiem?></p>
<p class="list_views"><?=$layout->views?> Views - <?=$layout->downloads?> Downloadeds</p>
<p class="list_link_view"><a href="<?=$layout->preview_link?>">Preview</a> - <a href="<?=$layout->download_link?>">Download</a></p>
</td>
</tr>
</table></div>
</td></tr>

<?php endif; ?>
<?php if(isset($layout->ad)): ?>
<?php else : ?>
<tr><td>
<table width="80%" cellpadding="5">
<tr>
<td width="50%" align="center" valign="top">
<img title="cssbody=[bigimage] header=[] body=[<img src='<?=$layout->thumb_large?>' />]" class="" src="<?=$layout->thumb_small?>" border="1"/></td>
<td width="50%" valign="top"><p class="list_title"><?=$layout->name?></p>
<p class="list_date">Added on <?=$layout->date->month->long?> <?=$layout->date->day->number?>, <?=$layout->date->year->long?> <?=$layout->date->time->hour?>:<?=$layout->date->time->min?> <?=$layout->date->time->meridiem?></p>
<p class="list_views"><?=$layout->views?> Views - <?=$layout->downloads?> Downloadeds</p>
<p class="list_link_view"><a href="<?=$layout->preview_link?>">Preview</a> - <a href="<?=$layout->download_link?>">Download</a></p>
</td>
</tr>
</table>
</td></tr>

<?php endif; ?>

<?php endforeach; ?>


Any1 have any idea on how I can get it grey,white,grey,white, etc without it duplicating?

Thanks in advance...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum