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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 03:20:08
Script start
Timing: Jan 19 2025 03:20:08
Module start 'layout'
Timing: Jan 19 2025 03:20:08
Module start 'content'
Timing: Jan 19 2025 03:20:10
Module end 'content'
Timing: Jan 19 2025 03:20:10
Script end

Main resources:

Total runtime1.5031 sec
Peak memory usage4,096.0000 KB
Database Queries52

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 591.4609152.6250
Module start 'layout' 0.00630.0042 744.085939.4453
Module start 'content' 0.01051.4907 783.5313503.9063
Module end 'content' 1.50120.0018 1,287.437512.1641
Script end 1.5030  1,299.6016 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.2332160.0002
Check MTime0.00130.0889160.0001
Mysql Total
Database connection0.00080.056510.0008
Mysqli_queries1.451296.5499520.0279
Looping result0.00080.0502500.0000
Template Total1.455396.820.7276
Template load0.00210.142220.0011
Template processing1.453196.678320.7266
Template load and register function0.00020.010110.0002
states
state_id_array0.00170.114710.0017
state_identifier_array0.00170.115320.0009
Override
Cache load0.00180.1183200.0001
Sytem overhead
Fetch class attribute can translate value0.00080.055810.0008
Fetch class attribute name0.00140.095330.0005
XML
Image XML parsing0.00050.035710.0005
class_abstraction
Instantiating content class attribute0.00000.000740.0000
General
dbfile0.00180.1184170.0001
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

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

Time used to render debug report: 0.0001 secs