The best way to customise an attribute

Author Message

Tristan Koen

Tuesday 10 June 2003 5:46:48 am

I need to customise the 'author' attribute. In its default form, it only provides entries for the authors' name and email address. I need to extend the functionality to include a small portrait and a short biography.

I could customise the code in kernel/classes/datatypes/ezauthor/ezauthorXXXX.php but I am worried about sacrificing application portability - i.e. what happens when say ez4.0 comes out?

Any advice from anyone on the best way to do this?

Paul Borgermans

Tuesday 10 June 2003 6:46:52 am

Tristan,

You should not change base dataypes to avoid future compatibility problems. Best to clone and extend this datatype to suit your needs.

However, can't you simply use extra attributes in the content class where you want to use the author field? Or do you need the multiple entry feature of that datatype?

In that case, create one or more "related objects" or even child objects based on a new "author class" which contains just the atttributes you need (look how its done in the admin site)? In that way you may easily add this to your templates where a user can choose from a pre-fetched list of authors or create a new one if the author does not exist yet. This also adds the benifit that that you can "manage" authors on your site and create other features in the future with the author objects.

Not done myself, but in priciple it should be possible without creating a new dataype.

eZ publish is a little bit like perl, "there is more than one way to do it". In practice: quite some things that previously needed php coding can be done in and with ezp3 templates.

Paul

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

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

Main resources:

Total runtime0.0258 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 588.2500151.2266
Module start 'layout' 0.00560.0035 739.4766220.7031
Module start 'content' 0.00910.0152 960.1797997.6953
Module end 'content' 0.02430.0015 1,957.875029.9922
Script end 0.0258  1,987.8672 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00259.6342140.0002
Check MTime0.00103.8818140.0001
Mysql Total
Database connection0.00093.568310.0009
Mysqli_queries0.002811.049030.0009
Looping result0.00000.047210.0000
Template Total0.00104.010.0010
Template load0.00083.218810.0008
Template processing0.00020.775810.0002
Override
Cache load0.00062.148910.0006
General
dbfile0.003413.044480.0004
String conversion0.00000.026840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs