Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

td in section only once

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks
View previous topic :: View next topic  
Author Message
coarsy
Smarty Rookie


Joined: 28 Jan 2004
Posts: 14
Location: Munich

PostPosted: Mon Feb 02, 2004 10:33 am    Post subject: td in section only once Reply with quote

Good morning @ all Smarties Smile

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 Smile)

Chris
Back to top
View user's profile Send private message Visit poster's website
AZTEK
Smarty Pro


Joined: 16 Apr 2003
Posts: 235
Location: Purdue University

PostPosted: Mon Feb 02, 2004 10:57 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
coarsy
Smarty Rookie


Joined: 28 Jan 2004
Posts: 14
Location: Munich

PostPosted: Mon Feb 02, 2004 11:05 am    Post subject: THX! Reply with quote

Thanx Aztek... A very simple way to reach my intention Smile
Very Great!

Chris
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP