[Solar-talk] dumb question
Jeff Surgeson
solar at 3hex.com
Thu Jul 27 06:53:56 PDT 2006
> > You have a if/else statement that will always returns true so the
> > else will
> > never be executed.
> >
> > <?php if ($this->list): ?>
> > blah de blah!
> > <?php else: ?>
> > <p><?php echo $this->getText('NO_BOOKMARKS_FOUND') ?></p>
> > <?php endif ?>
> >
> > I am taking for granted that the point of this is to execute the
> > else if there
> > are no bookmarks returned from db, correct?
>
> That is the idea. If you look for (e.g.) a tag name, and no
> bookmarks have that tag, it should show a graceful message rather
> than an error of "$this->list is not an array". Is it not working
> that way, or is it just a "why this?" question?
>
I use the same piece of code in my template and no it does not work.
$this->list is assigned to template as is as a result of a fetchAll call,
$this->list = $this->bd_news->fetchAll($where, $order, $page); in my action
script same as yours.
If the fetchAll retrieves 100 it is true and if 0 it is NULL which is also
true, correct?
So if/else will alsways return true and the else will never be displayed, it
just executes the foreach in the if with $this->list containing a null.
Am I making sense?
--
Jeff Surgeson
More information about the solar-talk
mailing list