 |
Smarty
The discussions here are for Smarty, a template engine for the PHP programming language. Dedicated server web hosting provided by Guru-host.eu. |
| View previous topic :: View next topic |
| Author |
Message |
coarsy Smarty Rookie

Joined: 28 Jan 2004 Posts: 14 Location: Munich
|
Posted: Mon Feb 02, 2004 10:33 am Post subject: td in section only once |
|
|
Good morning @ all Smarties
I have a table template like this:
<table border="0" cellspacing="0" cellpadding="0">
{section name=tr loop=$news_top step=2}
<tr>
{section name=td start=$smarty.section.tr.index loop=$smarty.section.tr.index+2}
<td class="font_black" valign="top" width="48%">
<img src="img/icons/icon_link.gif" border="0">
<a class="news" href="news.php?section=news&fct=show_news_more&cat_id={$cat_id_top[td]}&id_news={$id_news_top[td]}&lang={$lang}&sid={$sid}">
{$subject_top[td]}</a><br><br>
{if $image_top[td]}
<a class="news" href="news.php?section=news&fct=show_news_more&cat_id={$cat_id_top[td]}&id_news={$id_news_top[td]}&lang={$lang}&sid={$sid}">
<img src="news/images/{$image_top[td]}" align="left" border="0" class="newspic" alt="{$subject_top[td]}"></a>
{/if}
{$news_top[td]|default:"&"}<br></td>
<td width="4%">&</td>
{/section}
</tr>
{/section}
</table>
It works fine but i want to display the red marked td tag only
at the first loop... In other words: the td should be displayed only
in the middle of the table to place a vertical line beetween the contents...
How can i realize this?
Thanx for all suggestions )
Chris |
|
| Back to top |
|
AZTEK Smarty Pro

Joined: 16 Apr 2003 Posts: 236 Location: Purdue University
|
Posted: Mon Feb 02, 2004 10:57 am Post subject: |
|
|
You could always throw in a var to store if it has been displayed or not | Code: | <table border="0" cellspacing="0" cellpadding="0">
{section name=tr loop=$news_top step=2}
<tr>
{assign var="displayvbar" value="1"}
{section name=td start=$smarty.section.tr.index loop=$smarty.section.tr.index+2}
<td class="font_black" valign="top" width="48%">
<img src="img/icons/icon_link.gif" border="0">
<a class="news" href="news.php?section=news&fct=show_news_more&cat_id={$cat_id_top[td]}&id_news={$id_news_top[td]}&lang={$lang}&sid={$sid}">
{$subject_top[td]}</a><br><br>
{if $image_top[td]}
<a class="news" href="news.php?section=news&fct=show_news_more&cat_id={$cat_id_top[td]}&id_news={$id_news_top[td]}&lang={$lang}&sid={$sid}">
<img src="news/images/{$image_top[td]}" align="left" border="0" class="newspic" alt="{$subject_top[td]}"></a>
{/if}
{$news_top[td]|default:"&"}<br></td>
{if $displayvbar}
<td width="4%">&</td>
{assign var="displayvbar" value="0"}
{/if}
{/section}
</tr>
{/section}
</table> |
_________________ "Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane |
|
| Back to top |
|
coarsy Smarty Rookie

Joined: 28 Jan 2004 Posts: 14 Location: Munich
|
Posted: Mon Feb 02, 2004 11:05 am Post subject: THX! |
|
|
Thanx Aztek... A very simple way to reach my intention
Very Great!
Chris |
|
| Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|