Forums / Developer / Heritage - How to add an attribute to every classes ?

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.

eZ debug

Timing: Jan 18 2025 18:32:00
Script start
Timing: Jan 18 2025 18:32:00
Module start 'content'
Timing: Jan 18 2025 18:32:01
Module end 'content'
Timing: Jan 18 2025 18:32:01
Script end

Main resources:

Total runtime0.8367 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.0064 587.8594180.8125
Module start 'content' 0.00640.6907 768.6719648.7188
Module end 'content' 0.69700.1395 1,417.3906337.0547
Script end 0.8366  1,754.4453 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00450.5356210.0002
Check MTime0.00170.2047210.0001
Mysql Total
Database connection0.00130.155710.0013
Mysqli_queries0.755190.24732070.0036
Looping result0.00250.29472050.0000
Template Total0.797195.320.3986
Template load0.00280.338520.0014
Template processing0.794394.934720.3971
Template load and register function0.00020.020510.0002
states
state_id_array0.00280.336610.0028
state_identifier_array0.00130.155220.0006
Override
Cache load0.00230.2731370.0001
Sytem overhead
Fetch class attribute can translate value0.00100.124150.0002
Fetch class attribute name0.00090.109880.0001
XML
Image XML parsing0.00130.156250.0003
class_abstraction
Instantiating content class attribute0.00000.002190.0000
General
dbfile0.00390.4655340.0001
String conversion0.00000.000630.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/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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 24
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs