Forums / General / Show "events" for the next X days

Show "events" for the next X days

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!

eZ debug

Timing: Jan 18 2025 16:20:28
Script start
Timing: Jan 18 2025 16:20:28
Module start 'content'
Timing: Jan 18 2025 16:20:29
Module end 'content'
Timing: Jan 18 2025 16:20:29
Script end

Main resources:

Total runtime0.6956 sec
Peak memory usage4,096.0000 KB
Database Queries224

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 587.7031180.8438
Module start 'content' 0.00540.5853 768.5469660.9688
Module end 'content' 0.59070.1048 1,429.5156348.4688
Script end 0.6955  1,777.9844 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00390.5640210.0002
Check MTime0.00150.2216210.0001
Mysql Total
Database connection0.00070.107210.0007
Mysqli_queries0.613088.12642240.0027
Looping result0.00190.26712220.0000
Template Total0.668496.120.3342
Template load0.00220.314320.0011
Template processing0.666295.773120.3331
Template load and register function0.00010.018810.0001
states
state_id_array0.00120.179410.0012
state_identifier_array0.00070.100520.0003
Override
Cache load0.00190.2718600.0000
Sytem overhead
Fetch class attribute can translate value0.00140.200930.0005
Fetch class attribute name0.00110.1587140.0001
XML
Image XML parsing0.00090.129230.0003
class_abstraction
Instantiating content class attribute0.00000.0040190.0000
General
dbfile0.00230.3265270.0001
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
13content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
16content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
6content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
8content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 45
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs