Previous Thread
Next Thread
Print Thread
Hop To
#240115 10/31/2010 2:11 AM
Joined: Oct 2007
Posts: 54
Likes: 2
G
Journeyman
Journeyman
G Offline
Joined: Oct 2007
Posts: 54
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: 54
Likes: 2
G
Journeyman
Journeyman
G Offline
Joined: Oct 2007
Posts: 54
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
Version 7.7.5 Images suddenly not displaying
by Stovebolt - 05/04/2024 11:19 AM
Bots
by Outdoorking - 04/13/2024 5:08 PM
Can you add html to language files?
by Baldeagle - 04/07/2024 2:41 PM
Do I need to rebuild my database?
by Baldeagle - 04/07/2024 2:58 AM
This is not a bug, but a suggestion
by Baldeagle - 04/05/2024 11:25 PM
Who's Online Now
3 members (Stovebolt, ahmed047, Gizmo), 931 guests, and 151 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240501)