Forums / General / Template fetch, avoid the extended_attribute_filter

Template fetch, avoid the extended_attribute_filter

Author Message

Sébastien Antoniotti

Sunday 04 May 2008 9:47:25 am

Hi !

I have an article class who has two datetime attributes, one to store the start of the publication and the other to store the end of the publication.

The start_publication attribute is required so he's never empty.
The end_publication attribute is not required so he can be blank, and here is my problem.

If the two attributes are set, this attribute_filter is working :

'attribute_filter', 	array(
'and',
array( 'article/start_publication', '<=', $actualtimestamp ),
array( 'article/end_publication', '>', $actualtimestamp )
)

The problem is that if end_publication is blank, objects are not fetched.

I have tryied to do this :

'attribute_filter',	array(
	'or',
	array(
		'and',
		array( 'article/start_publication', '<=', $actualtimestamp ),
		array( 'article/end_publication', '>', $actualtimestamp )
	),
	array(										                      
		array( 'article/end_publication', '=', '0' )
	)
)

But it doesn't works and I would prefer avoid to develop an extended_attribute_filter if possible...

Thanks in advance !

eZ Publish Freelance
web : http://www.webaxis.fr

André R.

Sunday 04 May 2008 11:26:40 pm

Why don't you use the publish workflow combined with the hide cronjob to do the same thing automatically in the background without the need for filters?
Anyway, the calendar in ezwebin tackles almost the same problem:
http://svn.ez.no/svn/extensions/ezwebin/trunk/packages/ezwebin_extension/ezextension/ezwebin/design/ezwebin/templates/full/event_view_calendar.tpl
http://svn.ez.no/svn/extensions/ezwebin/trunk/packages/ezwebin_extension/ezextension/ezwebin/design/ezwebin/templates/full/event_view_program.tpl

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

Sébastien Antoniotti

Sunday 04 May 2008 11:42:58 pm

Hi André,

You're right I'll maybe use the first solution : Wait until date to publish and cronjob to hide.

Thanks a lot !

eZ Publish Freelance
web : http://www.webaxis.fr