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.