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

dynamic rule problem

 
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 -> General
View previous topic :: View next topic  
Author Message
Kominniaro
Smarty n00b


Joined: 30 Aug 2014
Posts: 3

PostPosted: Sat Aug 30, 2014 12:50 pm    Post subject: dynamic rule problem Reply with quote

Hi,
I have a dynamic rule on my index page. One of the boxes projects info from another tab of my website:

Code:
<div class="main-page-box-2">
         <a href="{$language}/koncerty.html"><h2 class="cufon-font">{$box2.item_lang_title}</h2></a>
         {*<p><a href="{$language}/koncerty.html">{$box2.item_lang_body|stripslashes|strip_tags|truncate:190} <img src="public/images/right-arrow.png" /></a></p>*}
         <p><a href="{$language}/koncerty.html">{$koncerty[0].Item.item_creation_ts|date_format:"%d.%m.%Y"} - {$koncerty[0].item_lang_title} <img src="public/images/right-arrow.png" /></a></p>
      </div>


The problem is, whenever there is no up-to-date value in {$koncerty[0].Item.item_creation_ts|date_format:"%d.%m.%Y"} I get an error sign on the main page. I figured the best would be to write an "if-else" rule to avoid this but don't really know how..
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sat Aug 30, 2014 6:07 pm    Post subject: Reply with quote

Code:
{if isset($koncerty[0].Item.item_creation_ts)}
 {$koncerty[0].Item.item_creation_ts|date_format:"%d.%m.%Y"}
{/if}


Last edited by U.Tews on Sun Aug 31, 2014 7:51 am; edited 1 time in total
Back to top
View user's profile Send private message
Kominniaro
Smarty n00b


Joined: 30 Aug 2014
Posts: 3

PostPosted: Sat Aug 30, 2014 6:38 pm    Post subject: Reply with quote

thx so much for your reply. I get an error message saying:

Undefined index: ) in /home/hsj39042/public_html/system/libraries/Smarty/Smarty_Compiler.class.php on line 1285
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sun Aug 31, 2014 7:52 am    Post subject: Reply with quote

I had a wrong { in my code. It's now corrected
Back to top
View user's profile Send private message
Kominniaro
Smarty n00b


Joined: 30 Aug 2014
Posts: 3

PostPosted: Sun Aug 31, 2014 10:33 am    Post subject: Reply with quote

Thank you! It works now.
Back to top
View user's profile Send private message
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 -> General 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