|
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 |
the mrs Smarty n00b
Joined: 25 Jun 2003 Posts: 3
|
Posted: Mon Jun 30, 2003 10:07 pm Post subject: if statement |
|
|
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 |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Mon Jun 30, 2003 10:28 pm Post subject: |
|
|
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 |
|
Back to top |
|
the mrs Smarty n00b
Joined: 25 Jun 2003 Posts: 3
|
Posted: Mon Jun 30, 2003 11:23 pm Post subject: |
|
|
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 |
|
|
|
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
|