Previous Thread
Next Thread
Print Thread
Hop To
#240115 10/31/2010 2:11 AM
Joined: Oct 2007
Posts: 56
Likes: 2
G
Journeyman
Journeyman
G Offline
Joined: Oct 2007
Posts: 56
Likes: 2
Hello,

I häve a problem. My if-construction works but it make errors....

PHP Code
{if $postrow[topic].statusicon}
{foreach from=$postrow[topic].statusicon item=statusicon}
{then}
<img src="{$config.BASE_URL}/images/{$style_array.general}/{$statusicon.img}" alt="{$statusicon.alt}" title="{$statusicon.alt}" />
{/foreach}
{/then}
{else}
<img alt="" src="{$config.BASE_URL}/images/{$style_array.icons}/{$postrow[topic].icon}" />
{/else}
{/if} 

Can you help me this fix?

Thank you!

P.S.: Sorry for the bad english. I hope you understand what I mean.

Here in German:

Hallo,

ich möchte gerne die postlist.tpl ändern. So, dass die, wenn ein Thread geschlossen wurde/angepinnt/..., das Statusicon statt des Posticons angezeigt wird.

Die If-Abfrage selbst funktioniert, aber im Forum werden mir über den Themen Syntaxfehler wegen der {else} und {then} Anweisungen angezeigt.

Wie bekomme ich das in Ordnung?

Vielen Dank.

Last edited by Gismo der erste; 10/31/2010 2:14 AM.
Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
I think it's the {then} {/then} tags as I'm not familiar with those and I don't think you need those for what you're trying to do:

http://www.smarty.net/manual/en/language.function.foreach.php

Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
Actually you have a few problems in there it looks like. Try something like:

PHP Code

{if $postrow[topic].statusicon}
{foreach from=$postrow[topic].statusicon item=statusicon}
<img src="{$config.BASE_URL}/images/{$style_array.general}/{$statusicon.img}" alt="{$statusicon.alt}" title="{$statusicon.alt}" />
{/foreach}
{else}
<img alt="" src="{$config.BASE_URL}/images/{$style_array.icons}/{$postrow[topic].icon}" />
{/if} 
 

Rick #240120 10/31/2010 11:02 AM
Joined: Oct 2007
Posts: 56
Likes: 2
G
Journeyman
Journeyman
G Offline
Joined: Oct 2007
Posts: 56
Likes: 2
Hey Rick,

thank you! It works, no erorrs! laugh


Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
PHP 8 bug in membermanage.tmpl
by phoenix011235 - 09/08/2026 7:47 PM
Are any of these legitmate?
by Baldeagle - 09/06/2026 1:37 PM
8.0.1 Patch Changelog Discussion
by isaac - 11/26/2025 1:34 PM
Upgraded to ver8 - now can't login
by phoenix011235 - 10/24/2024 8:50 AM
Who's Online Now
2 members (vscope, SteveS), 683 guests, and 121 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Ride safe!
Ride safe!
by Morgan, December 7
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Powered by UBB.threads™ PHP Forum Software 8.1.0
(Snapshot build 20260527)