Forums / Developer / The best way to customise an attribute

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

eZ debug

Timing: Jan 30 2025 21:16:04
Script start
Timing: Jan 30 2025 21:16:04
Module start 'content'
Timing: Jan 30 2025 21:16:04
Module end 'content'
Timing: Jan 30 2025 21:16:04
Script end

Main resources:

Total runtime0.2334 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0080 589.1641370.2891
Module start 'content' 0.00810.0135 959.45311,001.4375
Module end 'content' 0.02160.2118 1,960.89063,889.8672
Script end 0.2334  5,850.7578 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00451.9328200.0002
Check MTime0.00140.5818200.0001
Mysql Total
Database connection0.00080.354310.0008
Mysqli_queries0.137058.68741410.0010
Looping result0.00130.56581390.0000
Template Total0.211490.510.2114
Template load0.00090.381310.0009
Template processing0.210590.153810.2105
Override
Cache load0.00050.232710.0005
Sytem overhead
Fetch class attribute can translate value0.00190.801910.0019
XML
Image XML parsing0.00030.122610.0003
General
dbfile0.00984.1980200.0005
String conversion0.00000.002730.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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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