Forums / Setup & design / A news archive by month (problem filtering by date)

A news archive by month (problem filtering by date)

Author Message

Cristian G. L.

Thursday 27 May 2004 12:22:10 am

Hi
I want to make a news archive, grouping news by month. A method to do this is make a news loop inside a months loop.
I tried to make a fetch for get all news published in an especific month (in this example, June). The following code don't show any news:

{let arrayNoticias=fetch(content, list, hash(parent_node_id, 53,
  					   sort_by, array(published, false() ),
					   attribute_filter, array( array('published|datetime(custom,'%m')', '=', '06' ) ) ) ) } 

I think that i should modify with operators de value ('06', June) instead of attribute (published). The only operators i know for do it are <i>maketime</i> or <i>makedate</i>. But these functions seems to be undocumented. I don't know if these functions are what i need and, in that case, i don't know how use it.
Maybe exist a better method for do a news archive by month (i am open for any idea), but i will need to know how to filter by date anyway.

Thanks in advance
(Sorry for my poor english.)

Cristian

Piotr Kwiatkowski

Thursday 27 May 2004 1:06:48 am

An example of news archive you can find in BLOG template at:
kernel/setup/packages/blog/files/default/design.blog/override/templates/archive.tpl

Cristian G. L.

Monday 31 May 2004 12:23:14 am

Thanks for reply.

I did the following for fetch all news of a month (June in the example):

{let arrayNoticias=fetch(content, list, hash(parent_node_id, 53,
					 sort_by, array(published, false() ),
					 attribute_filter, array( array( published, >=,
 									 maketime(0,0,0,6,1,2004) ),
								  array( published, <,
									 maketime(0,0,0,7,1,2004) ) )

And it works!

Bye

Cristian