[Solar-talk] dumb question

Paul M Jones pmjones at solarphp.com
Thu Jul 27 06:58:51 PDT 2006


On Jul 27, 2006, at 8:53 AM, Jeff Surgeson wrote:

>>> 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.

Hm, perhaps it should be "if (empty($this->list)) {...}" ?



--

Paul M. Jones  <http://paul-m-jones.com>

Solar: Simple Object Library and Application Repository
for PHP5.   <http://solarphp.com>

Savant: The simple, elegant, and powerful solution for
templates in PHP.   <http://phpsavant.com>




More information about the solar-talk mailing list