Is it possible to create derived classes?

Author Message

JC Francois

Wednesday 16 June 2004 1:13:56 pm

I want to create a site with one blog and one news section.

I want the titles of the blog entries and the news articles to be listed on the front page in a single list sorted by date.
I was thinking of creating a base class with the fields author, title, date, enable comments, then derive a class 'blog' with specific blog fields and a class 'article' with specific article fields.
By doing so I could fetch the content of the common fields and display them in a single list.

QUESTION: is it possible to derive a class from another in ezPublish? How?

Thanks,

JC

Paul Forsyth

Wednesday 16 June 2004 1:25:57 pm

No, it isnt possible to derive/inherit classes. When i first encountered eZ publish I thought this too :(

However, there is a perfectly good workaround. Use object relations. BY adding an object relation or an object relation list to your base class you can then add objects of other classes to your main object. The template code can then recognise what classes are being used and show the appropriate html. We use this model extensively.

paul

--
http://www.visionwt.com

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

Main resources:

Total runtime0.8805 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0079 588.0469152.6406
Module start 'layout' 0.00790.0033 740.687539.4766
Module start 'content' 0.01120.8677 780.1641459.8828
Module end 'content' 0.87890.0015 1,240.04698.1250
Script end 0.8804  1,248.1719 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.4034160.0002
Check MTime0.00140.1645160.0001
Mysql Total
Database connection0.00200.228410.0020
Mysqli_queries0.832794.5708540.0154
Looping result0.00050.0513520.0000
Template Total0.820293.220.4101
Template load0.00240.268020.0012
Template processing0.817992.891620.4089
Template load and register function0.00040.043310.0004
states
state_id_array0.00110.130610.0011
state_identifier_array0.00130.150420.0007
Override
Cache load0.00190.2121160.0001
Sytem overhead
Fetch class attribute can translate value0.00050.054420.0002
Fetch class attribute name0.00110.125520.0006
XML
Image XML parsing0.00020.024320.0001
class_abstraction
Instantiating content class attribute0.00000.000920.0000
General
dbfile0.00070.0805100.0001
String conversion0.00000.001040.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
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 10
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs