I have an event calendar using CGCalendar with a custom field called “Venue”. On one page I’m listing all the events in the classical manner (i. e. sorted by date) but on another page I want to have a list of venues and then the events happening at each venue listed under (or besides) it. So, what’s the way to list events by a custom field?
(It’s sufficient to list the events of the current year only, i. e. to use the yearlist template.)
List CGCalendar events by venue
Re: List CGCalendar events by venue
I think I used a separate template for this in the past and then did some if/then logic to test the custom field's value.
{if $event.fields.Venue == 'New York}
Then do something
{/if}
{if $event.fields.Venue == 'New York}
Then do something
{/if}
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo
--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
Re: List CGCalendar events by venue
Thanks but it’s not going to work this way because there are a lot of different venues and they are constantly changing.
Let me just think out loudly here, and correct me if I’m wrong:
How about looping through the events and creating an associative array with the venues as key and the event data as values, and then looping through that array again and creating the new list? Or am I making things more complicated than necessary? It doesn’t quite feel right, somehow.
Let me just think out loudly here, and correct me if I’m wrong:
How about looping through the events and creating an associative array with the venues as key and the event data as values, and then looping through that array again and creating the new list? Or am I making things more complicated than necessary? It doesn’t quite feel right, somehow.
Re: List CGCalendar events by venue
I’m still looking for a solution on this. If anyone has an idea I’m eager to hear it.
Re: List CGCalendar events by venue
how about instead of using a new field, just categorize your events by venue then list it by category?
Re: List CGCalendar events by venue
That’s not working either because I’m already using categories for – well – categories.
- paulbaker
- Dev Team Member
- Posts: 1465
- Joined: Sat Apr 18, 2009 10:09 pm
- Location: Maidenhead, UK
- Contact:
Re: List CGCalendar events by venue
But that's not going to stop you adding one category per venue and filtering by that though, is it?10010110 wrote:That’s not working either because I’m already using categories for – well – categories.
Re: List CGCalendar events by venue
It probably wouldn’t be if I was the only one managing the site but it’s confusing if someone else comes in. Also, there are several event categories so I would have to exclude each one in some if/else statement. And also, there are a lot of venues that are also changing every year so it would be very suboptimal user experience/interaction wise to have venues as categories.paulbaker wrote: But that's not going to stop you adding one category per venue and filtering by that though, is it?
There must be a way to filter/retreive events by custom fields.