|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
stratoz4 Smarty Rookie
Joined: 12 Aug 2003 Posts: 6
|
Posted: Sun Sep 14, 2003 10:51 am Post subject: IF statement help needed |
|
|
HI
look at the text below i have highlited the loop
in this loop i want it to skip items that {$topic.id} = 1
how would i modify the code below?
___________________________________________
<table class="outer" cellspacing="1">
<{if $block.full_view == true}>
<tr>
<th class="fhead"><{$block.lang_forum}></th>
<th class="fhead"><{$block.lang_topic}></th>
<th class="fhead" align="center"><{$block.lang_replies}></th>
<th class="fhead" align="center"><{$block.lang_views}></th>
<th class="fhead" align="right"><{$block.lang_lastpost}></th>
</tr>
<{foreach item=topic name=topics from=$block.topics}>
<{if $smarty.foreach.topics.iteration <= 5}>
<tr class="<{cycle values="waa,naa"}>">
<td><a href="<{$xoops_url}>/modules/newbb/viewforum.php?forum=<{$topic.forum_id}>"><{$topic.forum_name}></a></td>
<td><a href="<{$xoops_url}>/modules/newbb/viewtopic.php?topic_id=<{$topic.id}>&forum=<{$topic.forum_id}>"><{$topic.title}></a></td>
<td align="center"><{$topic.replies}></td>
<td align="center"><{$topic.views}></td>
<td align="right"><{$topic.time}></td>
</tr>
<{/if}>
<{/foreach}>
<{else}>
<tr>
<td class="head"><{$block.lang_topic}></td>
<td class="head" align="center"><{$block.lang_replies}></td>
<td class="head" align="right"><{$block.lang_lastpost}></td>
</tr>
<{foreach item=topic from=$block.topics}>
<tr class="<{cycle values="waa,naa"}>">
<td><a href="<{$xoops_url}>/modules/newbb/viewtopic.php?topic_id=<{$topic.id}>&forum=<{$topic.forum_id}>"><{$topic.title}></a></td>
<td align="center"><{$topic.replies}></td>
<td align="right"><{$topic.time}></td>
</tr>
<{/foreach}>
<{/if}>
</table>
<div style="text-align:right; padding: 5px;">
<a href="<{$xoops_url}>/modules/newbb/"><{$block.lang_visitforums}></a>
</div> |
|
Back to top |
|
ThermoDust Smarty Regular
Joined: 10 Sep 2003 Posts: 38
|
Posted: Sun Sep 14, 2003 11:05 am Post subject: |
|
|
I'm not 100% sure but,
Code: |
<{if $smarty.foreach.topics.iteration <= 5}>
change to
<{if $smarty.foreach.topic.id != 1}>
|
|
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Sun Sep 14, 2003 1:18 pm Post subject: |
|
|
Code: | {if $topic.id != 1} show item {/if} |
|
|
Back to top |
|
ThermoDust Smarty Regular
Joined: 10 Sep 2003 Posts: 38
|
Posted: Sun Sep 14, 2003 3:13 pm Post subject: |
|
|
Was my way aleast a way that can be done or was I wrong? |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Mon Sep 15, 2003 7:31 am Post subject: |
|
|
@ThermoDust: you where slightly wrong.
the specal hash-array $smarty.foreach.[name] only has the keys:
"iteration", "first", "last", "show" and "total" (and no "id"). see the top of http://smarty.php.net/manual/en/language.function.foreach.php for links to their documentation page. |
|
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
|