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.

eZ debug

Timing: Jan 18 2025 19:20:15
Script start
Timing: Jan 18 2025 19:20:15
Module start 'layout'
Timing: Jan 18 2025 19:20:15
Module start 'content'
Timing: Jan 18 2025 19:20:16
Module end 'content'
Timing: Jan 18 2025 19:20:16
Script end

Main resources:

Total runtime1.3948 sec
Peak memory usage4,096.0000 KB
Database Queries65

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0060 587.9141152.6250
Module start 'layout' 0.00600.0035 740.539139.4453
Module start 'content' 0.00961.3835 779.9844617.1250
Module end 'content' 1.39310.0017 1,397.109416.1641
Script end 1.3948  1,413.2734 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.2649160.0002
Check MTime0.00170.1225160.0001
Mysql Total
Database connection0.00090.066310.0009
Mysqli_queries1.320694.6789650.0203
Looping result0.00080.0559630.0000
Template Total1.362697.720.6813
Template load0.00220.158420.0011
Template processing1.360497.532120.6802
Template load and register function0.00010.009110.0001
states
state_id_array0.00110.081210.0011
state_identifier_array0.00090.062720.0004
Override
Cache load0.00200.1418480.0000
Sytem overhead
Fetch class attribute can translate value0.00090.063230.0003
Fetch class attribute name0.00110.075680.0001
XML
Image XML parsing0.00310.225030.0010
class_abstraction
Instantiating content class attribute0.00000.0016100.0000
General
dbfile0.00290.2071280.0001
String conversion0.00000.000640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
13content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 34
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs