On 17 Jun 2009, at 19:59, <php...@jakeman.plus.com> wrote:

I find the following works well for me to provide a list of webpage titles
with hyperlinks

     <ul>
       <li tal:repeat="item titles">
<a tal:content="item/title" tal:attributes="href item/ href">title
is missing</a>
       </li>
     </ul>

What I would also like to do is provide an empty entry if there are no
webpage titles in the database. For example:

     <ul>
       <li>
         No titles found.
       </li>
     </ul>

I'm confident PHPTAL can do this, but there are so many options that look as
though they might do the trick I'm not sure where to start.

Can anyone advise me?

In PHPTAL empty array evaluates to false, so this works:

<p tal:condition="not:titles">No titles found.</p>
<ul tal:condition="titles">
...


If you want an empty list item:

     <ul>
       <li tal:condition="not:titles">No titles found</li>
       <li tal:repeat="item titles">
<a tal:content="item/title" tal:attributes="href item/ href">title
is missing</a>
       </li>
     </ul>


--
regards, Kornel


_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to