Summary | in templates allow to check if array members exist |
Queue | Horde Framework Packages |
Type | Enhancement |
State | Resolved |
Priority | 1. Low |
Owners | Horde Developers (at) |
Requester | vilius (at) lnk (dot) lt |
Created | 03/16/2005 (7437 days ago) |
Due | |
Updated | 01/12/2006 (7135 days ago) |
Assigned | 03/16/2005 (7437 days ago) |
Resolved | 01/12/2006 (7135 days ago) |
Milestone | |
Patch | No |
State ⇒ Resolved
several places in IMP alone where loops inside of loops are required -
and without if statements it is impossible to accomplish this. This
has been implemented in HEAD and Horde 3.1.0.
State ⇒ Rejected
code that sets things up needs to be responsible for setting any
fields that you want to test against to false or array().
Why? Because Template doesn't look for what's in the template; it
takes the data you give it and puts it into whatever it finds. So if
you don't tell it about an index, it won't go find it.
So just set 'actions' => array() or => false, and this will work fine.
Assigned to
State ⇒ Assigned
code needs to be fixed to support IFs for array members.
State ⇒ New
Priority ⇒ 1. Low
Type ⇒ Enhancement
Summary ⇒ in templates allow to check if array members exist
Queue ⇒ Horde Framework Packages
from Agora.
------- threads.php -----------
/* Set up the template tags. */
$template = &new Horde_Template();
$template->set('threads', $threads_list, true);
------ templates/threads.html ---------
<loop:threads>
<tr>
<td class="<tag:threads.class /> nowrap">
<tag:threads.link /><tag:threads.message_subject /></a>
<span class="small">
[<loop:threads.actions><divider:threads.actions>,
</divider:threads.actions><tag:threads.actions
/></loop:threads.actions>]
</span>
</td>
You can note, that if threads.actions doesn't exist, you only see [, ]
in generated html code. And we cannot check it with
<if:threads.actions></if:threads.actions> because template engine only
can check top level array members for this, e.g. threads.
Hope that's understandable :)