HI,
According to docs
The Template class array for single variables is $TMPL->var_single, where the keys are the variable’s name and the the values are the full variable including brackets and any formatting parameters (i.e. for dates).
But the code
foreach ($TMPL->var_single as $key => $val)
{
echo '['.$key.']['.$val.']';
}
for the variables
{entries_list_entry_date date_format="%Y-%m-%d"}
{previous_entry_date date_format="%Y-%m-%d"}
{next_entry_date date_format="%Y-%m-%d"}
outputs these strings
[entries_list_entry_date date_format="%Y-%m-%d"][entries_list_entry_date date_format="%Y-%m-%d"]
[previous_entry_date date_format="%Y-%m-%d"][previous_entry_date date_format="%Y-%m-%d"]
[next_entry_date date_format="%Y-%m-%d"][next_entry_date date_format="%Y-%m-%d"]
instead of these
[entries_list_entry_date][entries_list_entry_date date_format="%Y-%m-%d"]
[previous_entry_date][previous_entry_date date_format="%Y-%m-%d"]
[next_entry_date][next_entry_date date_format="%Y-%m-%d"]
It seems that including parameters into key does not conform to docs, isn’t it?
Also the value does not include brackets, as it should according to docs.
Hi Lisa,
Single variables
{entries_list_entry_date}
{previous_entry_date}
{next_entry_date}
belong to my Entries List plugin.
I’m coding a new version of this plugin; in the new version I want to add possibility to use “date_format” parameter inside these variables, as here:
{entries_list_entry_date date_format="%Y-%m-%d"}
{previous_entry_date date_format="%Y-%m-%d"}
{next_entry_date date_format="%Y-%m-%d"}
I tried to parse these variables by looping through $TMPL->var_single array and found that its features seems to be different from description in docs.
In all cases I checked in $TMPL->var_single array keys and values are the same. Seeing this I do not understand the reason why $TMPL->var_single array is associative.
Contrary to description keys include parameters; also contrary to description values do not include brackets.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.