This site has been archived. To learn more about our current products Ibexa Content, Ibexa Experience, Ibexa Commerce head over to the Ibexa Developer Portal

eZ Community » Forums » Setup & design » date sort of content items
expandshrink

date sort of content items

date sort of content items

Monday 05 December 2011 12:10:13 pm - 8 replies

Hello Guys looking for advise on this one.

i need to provide a template which returns a list of content items (ill the same item) (easy so far)

the hang up i am having is that the date range of things being returned needs to be controlled by a dropdown list. 

so for example

<form>

<select>

 <option>last 4 days</option>

 <option>last 7 days</option>

 <option>last 14 days</option>

 <option>last 21 days</option>

</select>

</form>

Thanks

Nicholas

Monday 05 December 2011 1:02:39 pm

Hi Nicholas,

You can use jQuery eZ Filter plugin to add view parameters to the URL and then in your fetch you can add attribute_filter to get filtered content items.

{* Add this to your fetch function*}
 
  'attribute_filter', array( array( 'published',
                                        '>',
                                        $fromDate ) )
 
{* $fromDate is defined by currentdate() operator decreased by value of select option, 
keep in mind that you are working with timestamp*}

Monday 05 December 2011 1:52:07 pm

Hello Mario,

This solution looks perfect.

Thank you very much.

Nicholas

Monday 05 December 2011 2:34:00 pm

Hello Mario, is this Plugin compatible with JQUERY 1.8 as i cannot bind the method to the selector

 

Uncaught TypeError: Object #<Object> has no method 'ezFilter'

<script> 

jQuery(document).ready(function($) {

 $('#period').ezFilter(); 

});

</script>

<select id="period" name="period">   

 <option>4 days</option>   

 <option>7 days</option>   

 <option>14 days</option>   

 <option>21 days</option> 

 <option>28 days</option> 

</select>

Monday 05 December 2011 3:23:25 pm

Sorry Mario, tired eyes the JQUERY version i was quoting was the Jquery UI version.

I want to know if the plugin is compatible with JQUERY 1.7.1.

Thanks

Monday 05 December 2011 3:47:34 pm

I have answered my own question.

the plugin does support 1.7.1 but it throws an error

Uncaught TypeError: Object [object Object] has no method 'ezFilter'

Thanks for all your help Mario

 

Nicholas

Monday 05 December 2011 6:49:12 pm

You need to be sure that:

  1. jquery.eZFilter.1.0.js is included in your page
  2. jquery.eZFilter.1.0.js is included after jQuery, because plugin is dependant on it

Tuesday 06 December 2011 11:09:33 am

Mario is correct, my issue was around an old version of Jquery that was being included in early in the template.

Everything works fine. The only caveat i would make is that the extension is intented for people running EZ in Virtual Host mode. 

 

Otherwise the URLS look like

http://insightdev/intelbriefings/index.php?/action-archive/(period)/14

DOMAIN/index.php/(param-name)/value/?directory

Many thanks for your help though Marion its a great extension.

Thanks

Nicholas

Wednesday 07 December 2011 10:45:59 am

Mario is correct, my issue was around an old version of Jquery that was being included in early in the template.

Everything works fine. The only caveat i would make is that the extension is intented for people running EZ in Virtual Host mode. 

 

Otherwise the URLS look like

http://insightdev/intelbriefings/index.php?/action-archive/(period)/14

DOMAIN/index.php/(param-name)/value/?directory

Many thanks for your help though Marion its a great extension.

Hi Nicolas,

the plugin is compatible with jQuery v1.7.1, but indeed it suports only host access method.

I will look into this for the next update, together with other few things I want to add.

Hopefully it won't take too long happy.gif Emoticon

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from