Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Displaying only future events
Hello, I have an ‘events’ section, where I use glz_custom_fields for setting the date. The field is called ‘when’.
I’m trying to display events occurring in the future, and I’m using this code:
<txp:aks_article where=‘when >= adddate( now (), -1)’ sort=“when” section=“events” form=“event_list” limit=“10” />
but I get a blank page. Maybe I’m using the wrong custom field name? I tried also ‘custom_2’ as a field name, but nope.
Thank you very much
Last edited by Manaus (2023-07-24 20:15:50)
Offline
#2 2023-07-24 20:47:31
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,310
Re: Displaying only future events
Have you tried custom_n
instead of the field’s title?
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: Displaying only future events
Might this post help ?
I’ve used smd_query in the past like this – with populate="article"
so that you can use txp:tags in your event_list form:
<txp:smd_query query="SELECT *,
unix_timestamp(Posted) as uPosted,
unix_timestamp(LastMod) as uLastMod,
unix_timestamp(Expires) as uExpires
FROM textpattern
WHERE Status IN (4)
AND section = 'events'
AND custom_2 >= CURDATE()
ORDER BY custom_2 ASC"
wraptag="" break="" form="event_list"
populate="article" />
I’m guessing that could be transferred to aks_article like this:
<txp:aks_article where="custom_2 >= CURDATE()" sort="custom_2 asc" section="events" form="event_list" limit="10" />
but I’m guessing as I can’t see any docs for aks_article (makss’ site is no longer there).
TXP Builders – finely-crafted code, design and txp
Offline
Re: Displaying only future events
Thanks Jakob,
fiddling with smd_query I found out that CURDATE returns yyyy-mm-dd
format date, while custom_2 returns dd/mm/yyyy
. I wonder if might be this that hangs the engine.
Edit: and fixing the datepicker format saved the day… I’m back to aks_article now.
Last edited by Manaus (2023-07-25 07:33:42)
Offline
Pages: 1