|
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 |
Kominniaro Smarty n00b
Joined: 30 Aug 2014 Posts: 3
|
Posted: Sat Aug 30, 2014 12:50 pm Post subject: dynamic rule problem |
|
|
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 |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sat Aug 30, 2014 6:07 pm Post subject: |
|
|
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 |
|
Kominniaro Smarty n00b
Joined: 30 Aug 2014 Posts: 3
|
Posted: Sat Aug 30, 2014 6:38 pm Post subject: |
|
|
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 |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sun Aug 31, 2014 7:52 am Post subject: |
|
|
I had a wrong { in my code. It's now corrected |
|
Back to top |
|
Kominniaro Smarty n00b
Joined: 30 Aug 2014 Posts: 3
|
Posted: Sun Aug 31, 2014 10:33 am Post subject: |
|
|
Thank you! It works now. |
|
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
|