[SOLVED] ListIt2 display items from today

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
frankmanl
Power Poster
Power Poster
Posts: 425
Joined: Sat Jul 12, 2008 3:50 am

[SOLVED] ListIt2 display items from today

Post by frankmanl »

I try to use ListIt2 to display the agenda of a theater. Every item has a performance date, the date on which the show is performed (stored in a date time field as provided by the module).
In this agenda by default past performances should not be displayed, but they should still be available for search queries, so visitors can see what shows were done in the past.
When I set an end date (equal to the performance date) for each performance it will not be shown anymore in the agenda, once that end date is reached - exactly what I want.
BUT ... the item also can't be found by a search query anymore, while I want visitors to be able to see the theater's history.

Would it be possible to have all items in the list available and at the same time to show only items with a performance date bigger than or equal to today's date?

Frank
Last edited by frankmanl on Sun Aug 11, 2013 9:14 am, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: ListIt2 display items from today

Post by Dr.CSS »

Sounds like a job for News, you can do a search/replace to rename News to something else like Agenda...
User avatar
frankmanl
Power Poster
Power Poster
Posts: 425
Joined: Sat Jul 12, 2008 3:50 am

Re: ListIt2 display items from today

Post by frankmanl »

I tried News at first instance, but could not get it working, since I also need (custom) fields for date and time (with a date/time picker), advanced file upload (as in GBFilePicker), preferably also for multiselect and currency. I can't make those fields in News, while ListIt2 provides for that when extended by ListIt2XDefs.
If you know a solution to create at least a date/time field (including a date/time picker) and an advanced file uploader for News, I'd be more than happy to use News.
Stikki

Re: ListIt2 display items from today

Post by Stikki »

Yo,

Well time is saved as string format, like all other fielddef data is.

You need to convert it back to timestamp:

{if $item->field_alias|strtotime == $smarty.now}

Compares against fielddef time to current one.

Also, these static attributes available:

$item->create_time
$item->modified_time
$item->start_time
$item->end_time
User avatar
frankmanl
Power Poster
Power Poster
Posts: 425
Joined: Sat Jul 12, 2008 3:50 am

Re: ListIt2 display items from today

Post by frankmanl »

Thanks Stikki, I found out how to use this, I put it in my summary template like this:

Code: Select all

   {* pagination *}

   {* items *}
{foreach from=$items item=item}
   {* show everything till 6 hours after start of concert (=speeldatum) *}
{if ($item->fielddefs['speeldatum'].value|strtotime + 21600) >= $smarty.now}

   {* item *}
<div class="item"><a href="{$item->url}">
   {* field definitions *}
(...)

   {* end item *}

{/if}
{/foreach}
   {* end items *}

   {* pagination *}
This template indeed only shows current and future concerts.
Post Reply

Return to “Modules/Add-Ons”