Author
|
Message
|
Steph A
|
Monday 03 October 2005 4:08:56 am
I have a class called "event" with two date attributes - "event_start" and "event_stop". How can I show all the "events" for the next X days, including events already started (under progress). Anyone done this before, and willing to share the template - or lead me into the right direction? I have been looking around in the forum for ideas/solutions, but with no luck. Any help would be deeply appreciated..
|
Kristof Coomans
|
Monday 03 October 2005 4:47:22 am
I think this should work:
{let timestamp=maketime()
current=gettime(timestamp)
x=5
start = maketime( 0, 0, 0, $current.month, $current.day, $current.year
end = maketime( 23, 59, 59, $current.month, $current.day|sum( $x ), $current.year )
events = fetch ( 'content', 'list',
hash(
'parent_node_id', $node.node_id,
'attribute_filter', array
(
'or',
array( 'event_start', 'between', array( $start, $end ) ),
array( 'event_end', 'between', array( $start, $end ) )
)
)
)
}
independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org
|
Steph A
|
Monday 03 October 2005 5:41:53 am
Thank you. But I have another possible stupid question (I quite a newbie!): How do I make this result show nodes line-view? {node_view_gui view=line content_node=$:item}
or something?
|
Kristof Coomans
|
Monday 03 October 2005 5:48:48 am
{foreach $events as $event}
{node_view_gui view='line' content_node=$event}
{/foreach}
independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org
|
Steph A
|
Monday 03 October 2005 6:02:52 am
Thanks for your patient with me. But I am afraid I dont understand this code, and where to put what. This is the code I am trying to use as an "view/full" overide: {*?template charset=utf-8?*}
{let timestamp=maketime()
current=gettime(timestamp)
x=5
start = maketime( 0, 0, 0, $current.month, $current.day, $current.year
end = maketime( 23, 59, 59, $current.month, $current.day|sum( $x ), $current.year )
events = fetch ( 'content', 'list',
hash(
'parent_node_id', $node.node_id,
'attribute_filter', array
(
'or',
array( 'event_start', 'between', array( $start, $end ) ),
array( 'event_end', 'between', array( $start, $end ) )
)
)
)
{foreach $events as $event}
{node_view_gui view='line' content_node=$event}
{/foreach}
{/let}
Forever grateful if you can help me.... ;)
|
Kristof Coomans
|
Monday 03 October 2005 6:35:50 am
I made a little mistake in the attribute filter, I forgot to prepend the class identifiers.
{*?template charset=utf-8?*}
{let timestamp=maketime()
current=gettime(timestamp)
x=5
start = maketime( 0, 0, 0, $current.month, $current.day, $current.year
end = maketime( 23, 59, 59, $current.month, $current.day|sum( $x ), $current.year )
events = fetch ( 'content', 'list',
hash(
'parent_node_id', $node.node_id,
'attribute_filter', array
(
'or',
array( 'event/event_start', 'between', array( $start, $end ) ),
array( 'event/event_end', 'between', array( $start, $end ) )
)
)
)
{foreach $events as $event}
{node_view_gui view='line' content_node=$event}
{/foreach}
{/let}
independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org
|
Steph A
|
Monday 03 October 2005 6:47:41 am
I just get a blue document icon showing, when using this code: {let timestamp=maketime()
current=gettime(timestamp)
x=5
start = maketime( 0, 0, 0, $current.month, $current.day, $current.year
end = maketime( 23, 59, 59, $current.month, $current.day|sum( $x ), $current.year )
events = fetch ( 'content', 'list',
hash(
'parent_node_id', $node.node_id,
'attribute_filter', array
(
'or',
array( 'event/event_start', 'between', array( $start, $end ) ),
array( 'event/event_end', 'between', array( $start, $end ) )
)
)
)
{foreach $events as $event}
{node_view_gui view='line' content_node=$event}
{/foreach}
{/let}
**DEBUG INFO** Undefined variable: var in c:\ezpublish\ezpublish\var\news\cache\template\compiled\full_view_kalender-7ce7fd557d332cd3d382669e60c7eed2.php on line 49 Undefined variable: var in c:\ezpublish\ezpublish\var\news\cache\template\compiled\full_view_kalender-7ce7fd557d332cd3d382669e60c7eed2.php on line 51
|
Kristof Coomans
|
Monday 03 October 2005 7:02:10 am
Can you place this before the <b>foreach</b> loop:
{$events|count}
What do you get now?
independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org
|
Steph A
|
Monday 03 October 2005 7:08:14 am
The blue icon is gone, and nothing shows. DEBUG array_keys(): The first argument should be an array in c:\ezpublish\ezpublish\var\news\cache\template\compiled\full_view_kalender-7ce7fd557d332cd3d382669e60c7eed2.php on line 62
|
Kristof Coomans
|
Monday 03 October 2005 7:23:21 am
Some fixes in the code, this time I've tested it myself:
{let timestamp=maketime()
current=gettime($timestamp)
x=5
start = maketime( 0, 0, 0, $current.month, $current.day, $current.year )
end = maketime( 23, 59, 59, $current.month, $current.day|sum( $x ), $current.year )
events = fetch( 'content', 'list',
hash(
'parent_node_id', $node.node_id,
'attribute_filter', array(
'or',
array( 'event/event_start', 'between', array( $start, $end ) ),
array( 'event/event_end', 'between', array( $start, $end ) )
)
)
)
}
{foreach $events as $event}
{node_view_gui view='line' content_node=$event}
{/foreach}
{/let}
independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org
|
Steph A
|
Monday 03 October 2005 7:31:18 am
Okay, all previous debug error is gone. One warning: "Attribute filter returned false" Nothing shows....
|
Kristof Coomans
|
Monday 03 October 2005 7:39:46 am
Replace event_end with event_stop.
independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org
|
Steph A
|
Monday 03 October 2005 7:47:41 am
YEEES IT WORKS! You are my man ;) Thank you VERY much!
|