Jump to content

customizing look of content in foreach tags...


nando99

Recommended Posts

ok - 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...

 

Link to comment
Share on other sites

I'm so so... plus the php you see is part of the script - I've only added/modified what I think needed to do what I want it to do.

 

What do you mean, use 1 block? Any additional info is greatly appreciated..

Link to comment
Share on other sites

Yes - the foreach loop is being used to display the layouts.

 

I hate to sound like such a newbie, but what do you mean the array of data.

 

Some info: the layouts are added through a admin panel. The foreach loops is just used to populate the page with the layouts.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.