Can somebody help me with this? I have a LISE module I'm using to display events where one of the fields is called 'date and time' and is a LISE 'Select DateTime' field
I'm outputting the module like this:
{LISEEvents orderby='custom_date_and_time|DESC'}
How do I get it to only display dates in the future? Ones that havent passed already?
Thanks!
LISE dates entry - only display future
-
- Forum Members
- Posts: 192
- Joined: Mon Nov 26, 2018 3:09 pm
Re: LISE dates entry - only display future
If all entries were created in the recent LISE release, the dates are stored as UNIX timestamps so it's as simple as:
If entries were created in an older version, then they're stored as datetime (and newer entries might be unix timestamp, depending upon your preference setting) and will be harder to filter using the module tag. In this case I'd probably just do it in the template itself. It's less efficient and will mess up pagination, but can work:
Code: Select all
{LISEtest xsrstart_date=$smarty.now}
Code: Select all
{foreach from=$items item=item}
{if $item->date|date_format:U > $smarty.now}
do stuff
{else}
{* item is in the past *}
{/if}
{/foreach}
Not getting the answer you need? CMSMS support options
Re: LISE dates entry - only display future
Latest version(s) of LISE offer some extended filtering:
But like DIGI3 said: you're dates may be stored in a different format
Code: Select all
New Extended Date Filter Parameters
The filter_year and filter_month parameters have been deprecated and will be removed in the next major version upgrade of LISE. There is a new set of parameters to replace the previous functionality that you can use now with new and extended features. Using any of the old date filtering parameters will disable the use of the extended ones.
(optional) (new) xf_startday = 1 - The day you wish to start to filter by in a range of days. Defaults to current day. (1)
(optional) (new) xf_endday = 30 - The end day in a range of days you wish to filter by. Defaults to current day. (1)
(optional) (new) xf_startmonth = 1 - The month you wish to start to filter by in a range of months. Defaults to current month. (1)
(optional) (new) xf_endmonth = 12 - The end month in a range of months you wish to filter by. Defaults to current month. (1)
(optional) (new) xf_startyear = 1910 - The year you wish to start to filter by in a range of years. Defaults to current year. (1)
(optional) (new) xf_endyear = 2030 - The end year in a range of years you wish to filter by. Defaults to current year. (1)
Notes:
(1) For the date filters to start working you only needs one of the date parameters: all other omitted will default to current time.
Re: LISE dates entry - only display future
Seems those filters are exclusively for the start and end date fields of LISE.
My bad.
My bad.
-
- Forum Members
- Posts: 192
- Joined: Mon Nov 26, 2018 3:09 pm
Re: LISE dates entry - only display future
ah thats a shame, I did wonder if/how I could use xsrstart_date
So, if I go with DIGI3's other option:
Is it ok to leave nothing in between the {else} and {/if}?
So, if I go with DIGI3's other option:
Code: Select all
{foreach from=$items item=item}
{if $item->date|date_format:U > $smarty.now}
do stuff
{else}
{* item is in the past *}
{/if}
{/foreach}
Re: LISE dates entry - only display future
Note that you only need my second option if your entries are stored as formatted dates (old method).
If you don't need the {else} then just omit it entirely: {if x} do stuff {/if}
If you don't need the {else} then just omit it entirely: {if x} do stuff {/if}
Not getting the answer you need? CMSMS support options
-
- Forum Members
- Posts: 192
- Joined: Mon Nov 26, 2018 3:09 pm
Re: LISE dates entry - only display future
Hi DIGI3
No - am using the new LISE, not the old... I thought Veldon indicated the xsrstart_date wouldnt work?
It didnt work when I tried it anyway...!
No - am using the new LISE, not the old... I thought Veldon indicated the xsrstart_date wouldnt work?
It didnt work when I tried it anyway...!
Re: LISE dates entry - only display future
He was referring to the xf_* ones he shared, not my original suggestion of xsrstart_*, I've tested {LISEtest xsrstart_date=$smarty.now} and it works great for custom date fields.
Not getting the answer you need? CMSMS support options
-
- Forum Members
- Posts: 192
- Joined: Mon Nov 26, 2018 3:09 pm
Re: LISE dates entry - only display future
Hmm - will try again! Though implemented your other method and is working for me anyway