If I want to create a directory where instead of links, the listingd are all events...
I want listings to be in order of the event start date, and I want events that have happened to delete automatically.
I know I can set a start date and expirty date for each listing, but I want events to display as soon as they are submitted but be in odrder of event start time. If I used the standard listing start time as the event date, the listing would not show until the event date.
If I create a custom field for the event start times, I'm unsure how to set the field up such that I can display listings in event date order.
If you create a field in mysql's date format (use phpmyadmin) you can order by that. That'd mean you have to enter it consistently as YYYY-MM-DD though.
For its native fields, WSN doesn't use mysql's date field format and stores everything as unix timestamps instead. Doing that for a custom field is something I'll need to look into in the future.
With a mysql date field? Only with some php to rearrange it: <?php $parts = explode("-", "{THEDATEFIELD}"); echo "{$parts[2]}-{$parts[1]}-{$parts[0]}"; ?>
Comments on Events Directory
Forum Regular
Usergroup: Customer
Joined: Nov 27, 2006
Total Topics: 187
Total Comments: 465
If I want to create a directory where instead of links, the listingd are all events...
I want listings to be in order of the event start date, and I want events that have happened to delete automatically.
I know I can set a start date and expirty date for each listing, but I want events to display as soon as they are submitted but be in odrder of event start time. If I used the standard listing start time as the event date, the listing would not show until the event date.
If I create a custom field for the event start times, I'm unsure how to set the field up such that I can display listings in event date order.
Can this be achieved?
How is this best done?
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
If you create a field in mysql's date format (use phpmyadmin) you can order by that. That'd mean you have to enter it consistently as YYYY-MM-DD though.
For its native fields, WSN doesn't use mysql's date field format and stores everything as unix timestamps instead. Doing that for a custom field is something I'll need to look into in the future.
Expert
Usergroup: Customer
Joined: Aug 19, 2005
Location: England
Total Topics: 391
Total Comments: 1303
Whilst we input in the format YYYY-MM-DD, is it possible to display it DD-MM-YYY ??
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
With a mysql date field? Only with some php to rearrange it: <?php $parts = explode("-", "{THEDATEFIELD}"); echo "{$parts[2]}-{$parts[1]}-{$parts[0]}"; ?>
Expert
Usergroup: Customer
Joined: Aug 19, 2005
Location: England
Total Topics: 391
Total Comments: 1303
Thanks Paul, That exact string gave me a weird format - 04 00:00:00-08-2010
Just with {LINKEVENTDATE} displays it as 2010-08-04 00:00:00
I need it to display as: 04-08-2010 (dd-mm-yy no time)
I am guessing I need to adjust the script a bit? But sadly I am more than useless with php
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
Forgot about the time bit. <?php $dt = explode(" ", "{THEDATEFIELD}"); $parts = explode("-", $dt[0]); echo "{$parts[2]}-{$parts[1]}-{$parts[0]}"; ?>
Expert
Usergroup: Customer
Joined: Aug 19, 2005
Location: England
Total Topics: 391
Total Comments: 1303
Thanks Paul, That worked.