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