relating objects

Author Message

Rinze Cats

Wednesday 14 April 2004 9:04:51 am

Hiya,

I am creating an online magazine. Every edition has a variety of articles. I want to achieve that all the articles in the 'january edition' or the 'february edition' are related to eachother. In the ideal situation I would create all the articles, without publishing them, and publish them all at once when I publish the new homepage for this edition. (so publishing the homepage would result in publishing all articles in this edition).

From what I read in the documentation, the 'keyword' datatype could be used. So i added a keyword field to my article class, and my homepage class, but 'things aren't relating'. I also experimented with the 'object relation' datatype, but it doesn't seem to work.

I use this code which I got from the documentation on this site.:

{let related=$node.object.data_map.keywords.content.related_objects}
{section show=$related}
<h2>Related documents</h2>
<ol>
{section name=Related loop=$related}
<li><a href={$:item.url_alias|ezurl}>{$:item.name}</a></li>
{/section}
</ol>
{/section}
{/let}

I think I am going about it the wrong way, but can't figure this one out at all!

Many thanx for any help / pointers you can give me!

John Dalton

Thursday 15 April 2004 1:21:10 pm

I'm still working on my first EZPublish site, but it seems to me that what you're trying to do would be much easier if you put all of the articles for a given issue into the same folder. That is, create a new folder for each issue which has all the content for that issue.

Then it's easy to find all the articles for a given issue by simply listing everything in that folder. Your archive listing just has to know where all the folders are, and you don't have to worry about object relations at all.

I think if you try to do this with an object relation list for each article which points to all other articles in the same issue, it will get very messy and difficult to maintain.

Rinze Cats

Monday 19 April 2004 1:43:46 am

That does seem to be the way to go, the only problem is that all articles are placed in a certain category, and each category has it's own layout. I use a folder for each category and assign a section to the folders. Per section I can define the styles and Images. I am currently using related objects to combine all articles, since it seems that 'keywords' only works for objects of the same class

John Dalton

Monday 19 April 2004 4:35:02 pm

Ok, perhaps another approach would be to add an "issue" attribute to your article class. Put the issue number (or date, or whatever) in this field for each article, and then use fetch with an attribute filter to grab all of the articles with that attribute set to a certain value.

Have a look here:
http://ez.no/ez_publish/documentation/reference/data_fetching/content/list
I think example 10 would do the job if you checked for something like "article/issue = 200404" instead.

The related objects appraoch probably isn't too bad though if they're just all related to the homepage for that issue.

Rinze Cats

Wednesday 21 April 2004 12:59:35 am

Hi and thanx for the response!

I have a working 'related objects' solution at the moment. However, will it be possible somehow to publish the homepage, causing all articles in the issue to be published as well? Or would the use of a common attribute facilitate this better? Or can't this be achieved at all?

Concerning related objects. Can this also be a two way function? In other words, can I relate the article to the homepage causing it to be added in the homepage's related objects list?

Sebastiaan van der Vliet

Wednesday 21 April 2004 4:55:22 am

Hi,

We are working on an online magazine as well. The way we set it up is as follows: we created a class "issue" with a number of properties, including the checkbox option "current issue". We then created a folder called "back issues" in which you can add issue objects. All classes in the magazine (event, link, document, article') share the same attribute "include in issue". We changed the admin template slightly, so that the back issue objects are shown in a dropdown list. This is a bit more userfriendly than the "browse for related" objects function.

Once all items are tagged in this way, the homepage starts with the following statements:
first: select a single issue object marked as current,
second: select all objects (articles, links, events, etc) which have that issue as a related object.

Using the issue class it is also possible to define specific articles as featured items.

Its probably not the most effecient approach, but we've got the site cached. The latest issue is launched by simply changing the "current issue" attribute.

Regards,
Sebastiaan

Certified eZ publish developer with over 9 years of eZ publish experience. Available for challenging eZ publish projects as a technical consultant, project manager, trouble shooter or strategic advisor.

Rinze Cats

Thursday 06 May 2004 1:08:22 am

Hi, I have implemented a 'current issue' system as well, but run in to a problem.
I have current issues and archived issues.

all issues use the same pagelayout.tpl. in this template I select the homepage with current issue check and display it. Works fine. However, when opening a homepage from the archive, the template will check the current issue attribute, and open the current issue.

I have solved this by copying my pagelayout. one including the check. This is only used on first visit. This is a very ugly sollution since it involves copying my entire page template. I think I want to create a start template the finds the current issue and redirects to it, but I don't know how to implement this!

Another thing:
I relate articles to my homepage to assign them to a certain issue. Relating is a nasty job cause all articles reside in different folders. Is there a way to change the admin template to list all articles of an issue in one view,allowing the editor to relate them all at once. I have already included an issue attribute in my articles to distinguishe them!

many thanx!

Mark Marsiglio

Tuesday 18 May 2004 10:52:04 am

Rinze...Unfortunately I cannot help with the code to do it, but it is my understanding that the admin interface can be customized with override templates just as the user interface. It should be possible to create a custom view in the admin interface to create the listing that you desire.

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions

Jack Rackham

Tuesday 17 August 2004 12:02:16 pm

Sorry wrong forum!

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 22:16:57
Script start
Timing: Jan 18 2025 22:16:57
Module start 'layout'
Timing: Jan 18 2025 22:16:57
Module start 'content'
Timing: Jan 18 2025 22:16:58
Module end 'content'
Timing: Jan 18 2025 22:16:58
Script end

Main resources:

Total runtime0.8472 sec
Peak memory usage4,096.0000 KB
Database Queries81

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 589.2266152.6094
Module start 'layout' 0.00520.0025 741.835939.4141
Module start 'content' 0.00770.8380 781.2500731.7734
Module end 'content' 0.84570.0015 1,513.023420.1875
Script end 0.8472  1,533.2109 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.3777160.0002
Check MTime0.00130.1577160.0001
Mysql Total
Database connection0.00080.098210.0008
Mysqli_queries0.782292.3223810.0097
Looping result0.00070.0852790.0000
Template Total0.824397.320.4121
Template load0.00210.242920.0010
Template processing0.822297.049720.4111
Template load and register function0.00020.018310.0002
states
state_id_array0.00110.126410.0011
state_identifier_array0.00080.092920.0004
Override
Cache load0.00180.2156510.0000
Sytem overhead
Fetch class attribute can translate value0.00080.089650.0002
Fetch class attribute name0.00190.2273120.0002
XML
Image XML parsing0.00250.297450.0005
class_abstraction
Instantiating content class attribute0.00000.0028120.0000
General
dbfile0.00190.2238280.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
9content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
14content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.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: 34
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs