Ez template engine, debug

Author Message

Muu Sle

Friday 16 June 2006 4:02:23 pm

Hey,

I think the ez template engine has much to learn from smarty template engine.
For those of us who has used smarty we all know how logical and straight forward it is, I really appreciate the php like feel of it.

Take this for example:

Smarty

{if $foo_bar == 1 and $bar_foo == 1}
...
{/if}

eZ

{if and($foo_bar|eq(1), $bar_foo|eq(1))}
...
{/if}

That said, the ez template engine is very powerful indeed and I like it almost as much as Smarty... =)

Anyway, is there anyway to reveal all variables passed on to the template engine?

The

{$my_object|attribute(show, 2)}

is nice to explore the system, but you got to know the name of the var you want to explore.
And but of course, the doc/reference/objects are very handy, but still...

In Smarty debug all variables passed to the template engine is shown in a list.

Is there some kind of debug setting for this?

Regards,

. muusle

Patrick Kaiser

Sunday 18 June 2006 3:25:42 am

hi,

have a look at the 'dynamic debug' contribution. its a big improovement to the build in 'attribute|show' opperator.. http://ez.no/community/contribs/hacks/dynamic_debug

since the node object in ez publish is ways bigger than arrays/objects you would normally assign to a smarty template, it wouldnt be a good appoach to display all attributes of $node in ez by default (although you can define the disered depths in attribute|show ).

Anyway - you won't be able to debug effectivly if you don't know the names of your attributes..

cheers, patrick


Best regards,

Patrick

Muu Sle

Sunday 18 June 2006 6:21:34 am

Actually, a whole lot bigger! =)

Thanks for the tip, the extension really looks great, I will give it a go!

For the knowing the name of the variable part; what I meant was in Smarty debug there's a list of variables passed to the template engine per name, not necessarily the actual content of each and every variable.
Though the $node var is indeed the most important one, it would be nice in some occasions like dealing with collectors and customizing xml tags for the first time when you're not really sure what variables are present.

. muusle

Kristof Coomans

Sunday 18 June 2006 11:40:38 pm

You mean something like the get_defined_vars function of PHP ( http://be2.php.net/manual/en/function.get-defined-vars.php ) ?

That would be a nice addition. Template writers who don't have any knowledge about the kernel now have to take a look in the specific modules to see what's passed by to the template.

Can you post an enhancement request for this?

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Muu Sle

Monday 19 June 2006 4:08:40 am

Hi Kristof,

> You mean something like the get_defined_vars function of PHP
Exactly like the get_defined_vars.

// print all the available keys for the arrays of variables
print_r(array_keys(get_defined_vars()));

I think this would help many first timers and perhaps the more experienced ones too, when working with extensions and such.

> Can you post an enhancement request for this?
Will do.

. muusle

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.