Thursday 25 September 2003 5:08:52 am
##CORE ISSUE/QUESTION I have two strings representing dates for custom "event" objects and want to use these to display only current events in a folder. ...Anyone got any good ideas? I think it should be simple - my objective and approach so far is outlined below.
## OBJECTIVE To create a folder containing events objects that are sorted by the event's date, and to only display the events that are >= today ##APPROACH SO FAR
In work towards this objective , I have:
- Created a custom "events" object
- This includes a textline attribute (event_date) to represent the event date.
- The event_date attribute is used in the "object name pattern" of the Event Class (ie <event_date> | <name>). This allows me to use the Folder sort settings to put the events into event_date order. - I've created a folder template to display a brief section of introductory text and each of the events. ##PROBLEM Almost everything works well ... events are displayed in event_date order, BUT I can't seem to get the logic for only displaying events with event_date >=today. Summarised, template code for the folder is as follows: {* code to display folder header details *} {* select the event objects (id 17), sort by name *} {section loop=fetch(content,list,hash(parent_node_id,$node.node_id, class_filter_type, "include", class_filter_array, array(17),sort_by,array(array(name))))} {* PROBLEM HERE - decide whether objectdate >=today *} {section show=ge($:item.data_map.event_date.data_text,currentdate()|datetime(custom,"20%y-%m-%d"))} {* code to display a current event goes here *}
{/section} {/section}
==
Looking at the values, {$:item.data_map.event_final_date.data_text} =shows=> "2003-10-10" and {currentdate()|datetime(custom,"20%y-%m-%d")} =shows=> "2003-09-25" ##PLEA FOR HELP! Any ideas on the right way to use these two values to select between events >= today? Is there another better approach? Any thoughts, hints or insights gratefully accepted! Thanks & happy coding - Paul
|