Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2023-07-24 19:15:36

Manaus
Member
From: Turin, Italy
Registered: 2010-10-22
Posts: 251
Website

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,305

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

#3 2023-07-24 20:57:37

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,616
Website

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

#4 2023-07-25 07:15:38

Manaus
Member
From: Turin, Italy
Registered: 2010-10-22
Posts: 251
Website

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

Board footer

Powered by FluxBB