Forums / Developer / current id_class

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

eZ debug

Timing: Jan 20 2025 07:47:11
Script start
Timing: Jan 20 2025 07:47:11
Module start 'content'
Timing: Jan 20 2025 07:47:12
Module end 'content'
Timing: Jan 20 2025 07:47:12
Script end

Main resources:

Total runtime1.0656 sec
Peak memory usage4,096.0000 KB
Database Queries207

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0118 590.1094180.8438
Module start 'content' 0.01180.9269 770.9531675.9297
Module end 'content' 0.93870.1268 1,446.8828341.0703
Script end 1.0655  1,787.9531 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.3880210.0002
Check MTime0.00160.1456210.0001
Mysql Total
Database connection0.00130.119210.0013
Mysqli_queries0.977091.68442070.0047
Looping result0.00220.21062050.0000
Template Total1.024896.220.5124
Template load0.00200.189020.0010
Template processing1.022895.980920.5114
Template load and register function0.00010.010010.0001
states
state_id_array0.00100.092410.0010
state_identifier_array0.00090.088520.0005
Override
Cache load0.00170.1612380.0000
Sytem overhead
Fetch class attribute can translate value0.00110.101750.0002
Fetch class attribute name0.00100.0906100.0001
XML
Image XML parsing0.00360.335250.0007
class_abstraction
Instantiating content class attribute0.00000.0017120.0000
General
dbfile0.00770.7204490.0002
String conversion0.00000.000830.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 28
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs