Forums / Developer / More date sorting

More date sorting

Author Message

Pål Messenlien

Tuesday 15 November 2005 1:47:14 pm

Im working on a agenda list and got some problems sorting and listing the right stuff.
The agenda class consists of name, date and content.
This is the code ive got together listing it

{def $timestamp=currentdate()}
{def $idag=fetch('content','list', hash('parent_node_id', 308,
							attribute_filter, array( and, array( 296, '>=', $timestamp ) ),
							 'sort_by',array( 'attribute',true(),296 ) 
				))}			
{foreach $idag as $dagens}
	{node_view_gui content_node=$dagens view='agenda'}
{/foreach}

This functions for listing... but it skips the today agenda and jumps to the next day instead.
My next problem is that i want the list to list the items like this:
Todays agenda:
- Agenda 1
- Agenda 2
Wednesday 16. November
- Agenda 1
- Agenda 2
etc...
The code i use today for showing are this.

<b>{$node.object.data_map.dato.data_int|l10n( 'date' )}</b>
<a href={$node.url_alias|ezurl}>{$node.object.data_map.hendelse.content|wash}</a

Any suggestions?

--------------------------------------------
Høgskolen i Lillehammer
Lillehammer University College
http://www.hil.no
--------------------------------------------
Messenlien IT
http://messenlien.com
-------------------------------------------

Kristof Coomans

Wednesday 16 November 2005 12:42:00 am

I believe the problem is that the currentdate template operator returns a unix timestamp, including the current time.

You can use the following code to make a right timestamp to compare with:

{def $currentDate=currentdate()
     $current=gettime($currentDate)
     $timestamp = maketime( 0, 0, 0, $current.month, $current.day, $current.year )}

Related post: http://ez.no/community/forum/general/show_events_for_the_next_x_days

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

Pål Messenlien

Sunday 20 November 2005 5:13:39 am

Thanks this worked great!

--------------------------------------------
Høgskolen i Lillehammer
Lillehammer University College
http://www.hil.no
--------------------------------------------
Messenlien IT
http://messenlien.com
-------------------------------------------

K259

Sunday 20 November 2005 7:40:52 am

Hi Pål!
What kind of agenda are you working on? What functionality? Like the agenda in the contributions?

Do you have an url to the calendar?

Pål Messenlien

Sunday 20 November 2005 9:17:50 am

Im not fully done with the code yet. The agenda in contributions might do the trick, but im not looking for a callendar. I just need a list wich groups the happenings in days then shows it under the specific date. Will post the full code when im done.

--------------------------------------------
Høgskolen i Lillehammer
Lillehammer University College
http://www.hil.no
--------------------------------------------
Messenlien IT
http://messenlien.com
-------------------------------------------

K259

Sunday 20 November 2005 10:34:19 am

Great!
I wonder how to list arrangements in a list..and over these arrangements show which month they belong to. As you say:
month: june
-arrangement
-arrangement
month: july
-arrangement
-arrangement

Would be great to get a code on this.

André R.

Monday 30 January 2006 6:16:29 am

You can modify Agenda 2 into doing this really simple
You already have the list pr month.

http://ez.no/community/contribs/applications/agenda_2_based_on_the_work_of_stefano_guandalini_and_per_espen_kindblad

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom