Fetching articles from parent folder

Author Message

Sascha Carlin

Saturday 07 February 2004 10:21:53 am

Hi all ;-)

Goal: set up a calendar for appointments.

I've setup a section 'Termine' and a fitting folder Termine. All appointments should go in there. (Currently I simply use Article from Content class to create appointments, but apparently I will need to set up a decent content class.) Now what I want to do is create two differnt views on the articles in the Termine-folder: current articles (say all appointments with date from today to today+4 weeks) and a year overview (all appointments from the current year).

I looked at the fetch-operator but could not figure how to do that. Any hints?

cu, Sascha

Tore Skobba

Sunday 08 February 2004 2:56:41 pm

Hmm where are you storing the dates then? You say you are using the Article class, but that does not have any dates? I have also made an calendar the following way:

Class: Calendar_folder (Name, Description), only having Calendar_event as children
Class: Calendar_event (Name, intro, body, image, when (datetime))

I then in my Calendar_folder template fetch all Calendar_events sorted on when. You could do something like that and use {switch}{case} to terminate the displaying of the Calendar_events, or use more advanced fetch functionality.

Cheers
Tore

Sascha Carlin

Sunday 08 February 2004 3:38:46 pm

Hi Tore,

thank you for your input. Would you mind sharing your template code?

By now I have a content class and can set up appointments in the content folder.

How can I set up two different views of the same content (the appointments)? The goal was to have two views: the next 4 weeks and the current year (from jan to dec).

Thanks, Sascha

Tore Skobba

Monday 09 February 2004 2:52:20 am

Hmm again where is your date? Anyway here is my template code for my solution. I am using two view, standard full which show ALL events, and a inline view which only show the 4 upcoming ones.

Docs for making an new view: http://www.ez.no/ez_publish/documentation/building_an_ez_publish_site/the_news_page/news_archive

{* Full Calendar Folder view, shows all children of type Calendar event sorted on date *}
<h1>{$node.name}</h1>
{attribute_view_gui attribute=$node.data_map.description}
{* Listing of children *}
{* Fetch all children of calendar event type (none other objects should be in the calendar class!) *}
{let cal_list=fetch('content',list,
hash(parent_node_id, $node.node_id,
class_filter_type, include,class_filter_array, array(20),
sort_by,array('attribute',true(),175)))}
{* Where attribute 175 is an Date field called when *}

<ul class="content_list">
{section loop=$cal_list max=4}
<li><h2><a href={concat("/content/view/full/",$item.node_id)|ezurl}>
{$item.name} {'on'|i18n('design/gsa/node/view')}
{attribute_view_gui attribute=$item.data_map.when}
{attribute_view_gui attribute=$item.data_map.time}</a></h2>
<p> {attribute_view_gui attribute=$item.data_map.intro}
<a href={concat("/content/view/full/",$item.node_id)|ezurl}><br />{'Read more...'|i18n('design/gsa/node/view')}</a></p>
</li>
{/section}
</ul>

<h2>{"More happenings"|i18n('design/gsa/node/view')}</h2>
<ul class="plain">
{section loop=$cal_list offset=4}
<li>{node_view_gui view=line content_node=$item}</li>
{/section}
</ul>
{/let}

{* Inline Calendar folder view, show the first 4 Calendar event (for use on front page etc) *}
<div class="calendar">
{let cal_list=fetch('content',list,
hash(parent_node_id, $node.node_id,
class_filter_type, include,class_filter_array, array(20),
sort_by,array('attribute',true(),175)))}

<h2>{"Upcoming events"|i18n('design/gsa/node/view')}</h2>
<ul>
{section loop=$cal_list max=4}
<li><a href={concat("/content/view/full/",$item.node_id)|ezurl}>
{$item.name} {'on'|i18n('design/gsa/node/view')}
{attribute_view_gui attribute=$item.data_map.when}
{attribute_view_gui attribute=$item.data_map.time}</a>
</li>
{/section}
</ul>
{/let}
<a href={concat("/content/view/full/",55)|ezurl}>{"More events"|i18n('design/gsa/node/view')}</a>
</div>

Sascha Carlin

Tuesday 10 February 2004 8:28:01 pm

Thank you very much for sharing your code!

Actually everything worked out fine - after I set the Anonymous Role permissions to read objects of the type Termine I created. Silly me ;-)

Thanks again, you have been very helpful.

Regards, Sascha

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 04:34:14
Script start
Timing: Jan 31 2025 04:34:14
Module start 'layout'
Timing: Jan 31 2025 04:34:14
Module start 'content'
Timing: Jan 31 2025 04:34:14
Module end 'content'
Timing: Jan 31 2025 04:34:14
Script end

Main resources:

Total runtime0.0152 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 588.1328151.2109
Module start 'layout' 0.00510.0029 739.343836.6641
Module start 'content' 0.00800.0056 776.007894.0156
Module end 'content' 0.01360.0015 870.023437.9922
Script end 0.0151  908.0156 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002416.1170140.0002
Check MTime0.00106.7245140.0001
Mysql Total
Database connection0.00085.039410.0008
Mysqli_queries0.002416.038530.0008
Looping result0.00000.078510.0000
Template Total0.00117.310.0011
Template load0.00095.710010.0009
Template processing0.00021.601810.0002
Override
Cache load0.00053.286810.0005
General
dbfile0.00138.780180.0002
String conversion0.00000.053440.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