Heritage - How to add an attribute to every classes ?

Author Message

Antoine W.

Monday 06 June 2005 7:39:10 am

Hello,

I would like to set, for each object, if a left menu must be displayed or not.

So I must add an attribute in <b>every</b> classes in eZ publish (folder, gallery, image, article, ...).
Is it a way to do this easily, or must I edit every classes ?

Is <b>heritage</b> of attributes between classes planned for next versions of eZ publish ?

Thanks

Tom Couwberghs

Sunday 12 June 2005 11:53:48 pm

Hello Antoine,

there is no such thing as heritage of attributes in OO -languages, so I guess the ez-crew will not implement that.

Can't you structure your content in such a way that you could decide on a higher level (subtree, section) whether to show the left menu or not?
I've never encountered a situation where I needed this on object level.

Kind regards,

Tom

Paul Borgermans

Monday 13 June 2005 1:08:19 am

Hi

Inheritance is of course a key concept in OO languages. There was a discussion on this topic (ezp class inheritance) during the summer camp, but nothing decided yet. A virtual datatype that encapsulates any existing class would be a possibility too.

The idea of having custom defined attributes (like dublin core) for all classes has been brought up before in the forums too.

Antoine, I would reconsider what you want to achieve like Tom mentioned, maybe provide a "switch" with custom defined template variables to wether or not display a left-menu. Otherwise, you'll have to edit every class ...

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Tom Couwberghs

Monday 13 June 2005 3:59:09 am

Indeed Paul,

I must agree about the inheritance thing.

But we're still talking about content classes here, and not about an average OO-class.
I wasn't aware of the fact that the crew was considering it, it might be interesting to solve other problems.

Antoine W.

Tuesday 14 June 2005 5:25:12 am

Thanks for your answers.
In fact, I would like to define for some objects which items should be displayed in left menu (menu will be hidden if there's no items).
That's why I need to have an "Object relations" attribute for these objects. Putting this into templates wouldn't be enough flexible.
I think I'll create this attribute for most used classes (Folder, Article and Product) and I'll test in templates if this attribute exists for current node (in data_map). If not, menu will be hidden. So I wont have to edit every classes.

Geraint Edwards

Tuesday 14 June 2005 7:55:13 am

Whoops - ignore this.

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 20:56:06
Script start
Timing: Jan 18 2025 20:56:06
Module start 'layout'
Timing: Jan 18 2025 20:56:06
Module start 'content'
Timing: Jan 18 2025 20:56:06
Module end 'content'
Timing: Jan 18 2025 20:56:06
Script end

Main resources:

Total runtime0.7074 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.0056 589.1797152.6406
Module start 'layout' 0.00560.0035 741.820339.4922
Module start 'content' 0.00910.6967 781.3125643.6250
Module end 'content' 0.70580.0016 1,424.937516.1250
Script end 0.7073  1,441.0625 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.4947160.0002
Check MTime0.00140.1956160.0001
Mysql Total
Database connection0.00060.080210.0006
Mysqli_queries0.645591.2465700.0092
Looping result0.00080.1137680.0000
Template Total0.673395.220.3367
Template load0.00220.307020.0011
Template processing0.671194.875720.3356
Template load and register function0.00020.030710.0002
states
state_id_array0.00070.105510.0007
state_identifier_array0.00070.101120.0004
Override
Cache load0.00190.2652370.0001
Sytem overhead
Fetch class attribute can translate value0.00070.099340.0002
Fetch class attribute name0.00130.181180.0002
XML
Image XML parsing0.00130.177640.0003
class_abstraction
Instantiating content class attribute0.00000.002790.0000
General
dbfile0.00180.2518230.0001
String conversion0.00000.001440.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/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 24
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs