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

if statement

 
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
the mrs
Smarty n00b


Joined: 25 Jun 2003
Posts: 3

PostPosted: Mon Jun 30, 2003 10:07 pm    Post subject: if statement Reply with quote

I'm trying to conditionally show some a part of my template. I'm using
Code:

{foreach from=$books item=b}
<tr>
    <td><a href="booklog_edit.php?edit={$b.book_id}">{$b.book_title}</a></td>
    <td>{$b.book_author}</td>
    <td>{$b.book_status}</td>
    <td>{$b.book_added_on}</td>
</tr>
{if $show_notes > 0}<tr><td colspan="4">{$b.book_notes}</td></tr>{/if}
{/foreach}


Then in my php file I assign $show_notes using a value from a configuration file, which the user would set to 0 or 1 with $view_notes = 1. Not matter what it is set to (0 or 1), my code doesn't show up. What am I doing wrong? Is it because the if statement is inside the foreach?

thanks.
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Mon Jun 30, 2003 10:28 pm    Post subject: Reply with quote

your code looks fully correct. did you verify that $show_notes is set right?

put {"%d"|sprintf:$show_nodes} in your template or use your favourite way of debugging Smile
Back to top
View user's profile Send private message Send e-mail Visit poster's website
the mrs
Smarty n00b


Joined: 25 Jun 2003
Posts: 3

PostPosted: Mon Jun 30, 2003 11:23 pm    Post subject: Reply with quote

Oh wait! It appears the code is being added. Let me look at it some more and see what is going on. Thanks!
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