Forums / Developer / Problem with fetching by date

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

Problem with fetching by date

Author Message

Norman Leutner

Wednesday 08 June 2005 2:53:02 am

I need to fetch news within the last year, sorted by month.

This works fine:

{let today_info=gettime(currentdate())


     news=fetch('content','list',
                     hash(	parent_node_id, '93',
					        attribute_filter, array( array( 'content_news/date', '>=', makedate($today_info.month,1,$today_info.year,) ),
								                     array( 'content_news/date', '<',  makedate($today_info.month| inc,1,$today_info.year,) )
								                   )
					      )
		        )
}

	{section loop=$news}
	  {node_view_gui view=line content_node=$:item}
	{/section}
{/let}

This:

{* array für Montatsanzeige, aktuelle Monatsdaten *}
{let month=array(0,1,2,3,4,5,6,7,8,9,10,11) today_info=gettime(currentdate())}

{section loop=$month name=thismonth}

  {* Text Montatsanzeige *}
  <b>{makedate($today_info.month|sub($thismonth:item),1,$today_info.year,)|datetime(custom,"%M")}</b><br>

  {* Show Dates / debugging *}
  -> Timestamp: {makedate($today_info.month|sub($thismonth:item),1,$today_info.year,)} ## {makedate($today_info.month|sub($thismonth:item),1,$today_info.year,)|datetime(custom,"%d.%m.%Y")}<br>
  -> Timestamp: {makedate($today_info.month|sub($thismonth:item,-1),1,$today_info.year,)} ## {makedate($today_info.month|sub($thismonth:item,-1),1,$today_info.year,)|datetime(custom,"%d.%m.%Y")}<br>

   {* BEGINN Anzeige der News nach Monat *}
	{let thisnews=fetch('content','list',
						 hash(	parent_node_id, '93',
								attribute_filter, array( array( 'content_news/date', '>=', makedate($today_info.month|sub($thismonth:item),1,$today_info.year,) ),
														 array( 'content_news/date', '<',  makedate($today_info.month||sub($thismonth:item,-1),1,$today_info.year,) )
													   )
							  )
					   )
	}
		{section loop=$thisnews}
		  {node_view_gui view=line content_node=$:item}
		{/section}
	{/let}
  {* END Anzeige der News nach Monat *}

{/section}

{/let}

returns:
Error: eZTemplate @ extension/electronicbeats/design/plain/override/templates/full/index_news.tpl:40[2] Jun 08 2005 11:54:41
<b>Unknown template variable 'thisnews' in namespace '' </b>

Any suggestions?

Mit freundlichen Grüßen
Best regards

Norman Leutner

____________________________________________________________
eZ Publish Platinum Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh

Norman Leutner

Thursday 09 June 2005 3:22:05 am

Small problem, small solution:

{* array für Montatsanzeige, aktuelle Monatsdaten *}
{let month=array(0,1,2,3,4,5,6,7,8,9,10,11) today_info=gettime(currentdate())}

{section loop=$month name=thismonth}

  {* Text Montatsanzeige *}
  <b>{makedate($today_info.month|sub($thismonth:item),1,$today_info.year,)|datetime(custom,"%F %y")}</b><br>

  {* Show Dates / debugging *}
  -> Timestamp: {makedate($today_info.month|sub($thismonth:item),1,$today_info.year,)} ## {makedate($today_info.month|sub($thismonth:item),1,$today_info.year,)|datetime(custom,"%d.%m.%Y")}<br>
  -> Timestamp: {makedate($today_info.month|sub($thismonth:item,-1),1,$today_info.year,)} ## {makedate($today_info.month|sub($thismonth:item,-1),1,$today_info.year,)|datetime(custom,"%d.%m.%Y")}<br>

  {* BEGINN Anzeige der News nach Monat *}
	{section loop=fetch('content','list',
						 hash(	parent_node_id, '93',
								attribute_filter, array( array( 'content_news/date', '>=', makedate($today_info.month|sub($thismonth:item),1,$today_info.year,) ),
														 array( 'content_news/date', '<',  makedate($today_info.month||sub($thismonth:item,-1),1,$today_info.year,) )
													   )
							  )
					   )
	}
	  {node_view_gui view=line content_node=$:item}
	{/section}
  {* END Anzeige der News nach Monat *}

{/section}

{/let}

{section loop=fetch..
instead of
{let thisnews=fetch...

Mit freundlichen Grüßen
Best regards

Norman Leutner

____________________________________________________________
eZ Publish Platinum Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh