Displaying a foreach array in specific cells in a table

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Dan36
Forum Newbie
Posts: 5
Joined: Mon Feb 08, 2010 2:51 pm

Displaying a foreach array in specific cells in a table

Post by Dan36 »

Hi, some help please
I’m using a smarty script to display some grids. I’ve tinkered around with the script to try and get the grids displayed in specific cells in a table but with no joy. :banghead:

Below is the code which generates the grids.

Code: Select all

<table cellspacing="0" cellpadding="0" width="1000" align="center" border="0"> 
{foreach item=grids from=$rows} 
<tr> 
{foreach item=grid from=$grids} 
<td> 
<img src="{$grid->url()|escape}" usemap="#grid_{$grid->id}" width="{$grid->width|escape}" height="{$grid->height|escape}" alt="" border="0" /></div><div style="clear: both"></div> 
</td> 
{/foreach} 
</tr> 
{/foreach} 
</table> 
{foreach item=rid_id from=$rids_ids} 
<div id="region-hint-{$rid_id}" class="hidde"><img src="show_image.php?rid={$rid_id}" /></div> 
{/foreach}
If poss I would like the grids generated to be displayed in specific cells i.e.

Code: Select all

<table width="500" border="1"> 
<tr> 
<td width="100">grid id=2 to be displayed here</td> 
<td width="33">&nbsp;</td> 
<td width="100">grid id=3 to be displayed here</td> 
<td width="34">&nbsp;</td> 
<td width="100">grid id=4 to be displayed here</td> 
<td width="33">&nbsp;</td> 
<td width="100">grid id=5 to be displayed here</td> 
</tr> 
<tr> 
<td colspan="7">grid id=1 to be displayed here</td> 
</tr> 
</table>
Can any one help please?
Many thanks Dan
Dan36
Forum Newbie
Posts: 5
Joined: Mon Feb 08, 2010 2:51 pm

Re: Displaying a foreach array in specific cells in a table

Post by Dan36 »

Anyone please?
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Displaying a foreach array in specific cells in a table

Post by josh »

You're posting "smarty" code on a php forum. Not a sin I guess, but why not use PHP code instead of smarty? Surely you'd get more community support that way too.
Dan36
Forum Newbie
Posts: 5
Joined: Mon Feb 08, 2010 2:51 pm

Re: Displaying a foreach array in specific cells in a table

Post by Dan36 »

Indeed. Not a sin!

Anyone like to carry this out for some paid freelance work? I've created a new post on the jobs board. PM me if your interested.

viewtopic.php?f=17&t=112729

Many thanks Dan
Post Reply