Custum template trouble

Author Message

Steph A

Tuesday 06 December 2005 3:58:15 am

This template was ment to show "events" between a "event_start" and "event_stop" date. But I have realized that it has got some fault to it.

Lets say that todays date/time is: 06.12.2005 13.00

We then have a event that starts at 06.12.2005 15.00 and ends at 07.12.2005 15.00
This event will show on both today and tomorrow.

BUT, if we have a event that starts 01.12.2005 15.00 and ends 20.12.2005 15.00 this wil NOT show today.

Anyone that could help me?

{* code for today *}
{let timestamp=maketime()      
current=gettime($timestamp)      
x=0      
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}


{* code for tomorrow *} 

{let timestamp=maketime()      
current=gettime($timestamp)      
x=1
y=1      
start = maketime( 0, 0, 0, $current.month, $current.day|sum( $y ), $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}

{* ...and so on *}

Kristof Coomans

Tuesday 06 December 2005 4:23:33 am

I think this will do it:

...
'attribute_filter', array(                    
    'and',                        
    array( 'event/event_start', '<=', $end ),                        
    array( 'event/event_end', '>=', $start )
)
...

 

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

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 20 2025 20:18:48
Script start
Timing: Jan 20 2025 20:18:48
Module start 'layout'
Timing: Jan 20 2025 20:18:48
Module start 'content'
Timing: Jan 20 2025 20:18:49
Module end 'content'
Timing: Jan 20 2025 20:18:49
Script end

Main resources:

Total runtime1.2645 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0052 589.0234151.2109
Module start 'layout' 0.00520.0049 740.234436.6484
Module start 'content' 0.01021.2536 776.8828550.5469
Module end 'content' 1.26370.0007 1,327.429711.8594
Script end 1.2644  1,339.2891 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.2427160.0002
Check MTime0.00120.0987160.0001
Mysql Total
Database connection0.00080.067110.0008
Mysqli_queries1.225296.8939540.0227
Looping result0.00050.0380520.0000
Template Total1.224196.820.6121
Template load0.00200.160620.0010
Template processing1.222196.647320.6110
Template load and register function0.00010.011310.0001
states
state_id_array0.00100.076810.0010
state_identifier_array0.00510.399920.0025
Override
Cache load0.00170.1333150.0001
Sytem overhead
Fetch class attribute can translate value0.00050.039220.0002
Fetch class attribute name0.00080.066130.0003
XML
Image XML parsing0.00060.047920.0003
class_abstraction
Instantiating content class attribute0.00000.000730.0000
General
dbfile0.00070.0518160.0000
String conversion0.00000.001140.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
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/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: 12
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs