current id_class

Author Message

Alain Mangana

Wednesday 08 October 2008 7:36:19 am

Hi!
how to fetch the id of the current class in a template

http://tikdem.com
/

Łukasz Serwatka

Wednesday 08 October 2008 9:57:08 am

{$node.object.contentclass_id}
or
{$node.object.content_class.id}
or identifier
{$node.object.content_class.identifier}

You can also use fetch functions related to class
http://ez.no/doc/ez_publish/technical_manual/4_0/reference/modules/content/fetch_functions/class
http://ez.no/doc/ez_publish/technical_manual/4_0/reference/modules/class

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

André R.

Thursday 09 October 2008 3:27:38 am

Avoid the two last examples unless you need to fetch the entire content class object ($node.object.content_class).

For identifier:
{$node.class_identifier}
or
{$node.object.class_identifier}

Same result, just fewer database calls.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Piotrek Karaś

Thursday 16 October 2008 10:48:08 am

Avoid the two last examples unless you need to fetch the entire content class object ($node.object.content_class).

Yup,

That's why smart structure planning may take care of site optimization at the same time, when you only display object names and other pre-fetched pieces of data rather than reach into data_map for your lists generation.

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

André R.

Thursday 16 October 2008 2:23:29 pm

data_map is prefetched (all attributes on all fetched nodes in one sql call) in content tree and content list fetches, this is controllable with the load_data_map fetch parameter from 3.10 and up so you can disable it if you don't use the data_map on the fetched node set.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Piotrek Karaś

Friday 17 October 2008 12:36:58 am

Ok, I must have been thinking of PHP-object-level when I was writing that, and there I need to call for data_map explicitly.
But I hadn't known about that load_data_map fetch feature - interesting. Not working with tpls much... ;)
Thanks,
Piotrek

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

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:22:24
Script start
Timing: Jan 18 2025 19:22:24
Module start 'layout'
Timing: Jan 18 2025 19:22:24
Module start 'content'
Timing: Jan 18 2025 19:22:25
Module end 'content'
Timing: Jan 18 2025 19:22:25
Script end

Main resources:

Total runtime0.7633 sec
Peak memory usage4,096.0000 KB
Database Queries70

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0065 589.5703152.6094
Module start 'layout' 0.00650.0044 742.179739.4141
Module start 'content' 0.01090.7508 781.5938670.8672
Module end 'content' 0.76170.0016 1,452.460916.1875
Script end 0.7633  1,468.6484 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.4445160.0002
Check MTime0.00150.1942160.0001
Mysql Total
Database connection0.00110.140110.0011
Mysqli_queries0.687290.0254700.0098
Looping result0.00090.1162680.0000
Template Total0.727595.320.3637
Template load0.00200.267620.0010
Template processing0.725495.033620.3627
Template load and register function0.00010.016010.0001
states
state_id_array0.00100.133910.0010
state_identifier_array0.00120.161520.0006
Override
Cache load0.00170.2282380.0000
Sytem overhead
Fetch class attribute can translate value0.00110.140740.0003
Fetch class attribute name0.00180.2398100.0002
XML
Image XML parsing0.00410.535740.0010
class_abstraction
Instantiating content class attribute0.00000.0033120.0000
General
dbfile0.00170.2289380.0000
String conversion0.00020.022440.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
6content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/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: 28
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs