Variable number of class attributes

Author Message

Oliver Frommel

Wednesday 05 September 2007 6:02:05 am

Hi,

is it possible to create as class with a variable number of attributes?
Or, in another words, to encapsulate attribute types in a kind of array or
as a "linked list"?

For instance to have an article reference a number of URLs that is
unknown at the time of class creation. If it isn't possible at this time
it would be a great addition to eZ publish :)

Best
Oliver

Atle Pedersen

Wednesday 05 September 2007 6:18:31 am

Hi,

you cannot do this directly, but what you can do is having subnodes with objects containing the url information. Then you can have as many objects as you want.

An alternative method is using the object relations attribute to link to objects containing url information.

I would probably go for the first method since that means you don't have to edit the article in order to add more links.

Xavier Serna

Thursday 06 September 2007 6:36:20 am

Hi Olivier,

the fact is that for your case, is as simple as add an ezmatrix attribute to your class, you can define the required number of columns you want for each row (in your case, each url), for example one column for the website name and another one for the website url.
The rows are added at the time of the article editing, without limitation, so you can add as many rows as you need in each object.

hth!

--
Xavier Serna
eZ Publish Certified Developer
Departament de Software
Microblau S.L. - http://www.microblau.net
+34 937 466 205

Betsy Gamrat

Saturday 29 September 2007 6:45:21 pm

Hi,

<i>For instance to have an article reference a number of URLs that is
unknown at the time of class creation. If it isn't possible at this time
it would be a great addition to eZ publish :)</i>

This is an object relation list. :)

Betsy

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 11:44:52
Script start
Timing: Jan 18 2025 11:44:52
Module start 'layout'
Timing: Jan 18 2025 11:44:52
Module start 'content'
Timing: Jan 18 2025 11:44:53
Module end 'content'
Timing: Jan 18 2025 11:44:53
Script end

Main resources:

Total runtime0.8916 sec
Peak memory usage4,096.0000 KB
Database Queries64

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0108 587.9375152.6250
Module start 'layout' 0.01080.0104 740.562539.4453
Module start 'content' 0.02120.8687 780.0078631.6328
Module end 'content' 0.88990.0017 1,411.640612.1563
Script end 0.8915  1,423.7969 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00860.9643160.0005
Check MTime0.00170.1942160.0001
Mysql Total
Database connection0.00140.156210.0014
Mysqli_queries0.814491.3370640.0127
Looping result0.00080.0860620.0000
Template Total0.788188.420.3940
Template load0.00370.419320.0019
Template processing0.784387.968420.3922
Template load and register function0.00010.015610.0001
states
state_id_array0.03804.259110.0380
state_identifier_array0.00170.189320.0008
Override
Cache load0.00340.3781320.0001
Sytem overhead
Fetch class attribute can translate value0.00110.120940.0003
Fetch class attribute name0.00100.110170.0001
XML
Image XML parsing0.00180.206140.0005
class_abstraction
Instantiating content class attribute0.00000.001570.0000
General
dbfile0.00130.1426280.0000
String conversion0.00000.001340.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
4content/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
5content/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
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs