Help with an IF statement in Company Directory
Posted: Tue Jul 04, 2017 8:32 pm
Hi Folks
I'm using Company Directory for a Music Venue and Bands Artists Directory.
As CD does not support 'Pretty URLs' for some of the features.
i.e. detailtemplate, I'm having to use a single detail template for several types of details.
One of the problems I have is this.
Venues have facilities: Car Park, Pool Table, Jukebox, Baby Changing etc
Bands and Artists don't.
I need to enter an 'IF' statement that, if none of the facilities have an entry, nothing is created (that's easy, even I can do that), but...
If there is one or more of the facilities added, I want to create a div with an h4 header and with all the entries in.
What is the correct syntax for, in my case 14 possible entries?
Is there a way or adding all 14 Field Definitions to a single IF statement and if just one has an entry create the div etc.
Here's just one of the Field Definitions
I know the following is wrong, but am I way off or near the mark?
Any help appreciated for an amateur in php. I'm way better at CSS and Graphic Design 
I'm using Company Directory for a Music Venue and Bands Artists Directory.
As CD does not support 'Pretty URLs' for some of the features.
i.e. detailtemplate, I'm having to use a single detail template for several types of details.
One of the problems I have is this.
Venues have facilities: Car Park, Pool Table, Jukebox, Baby Changing etc
Bands and Artists don't.
I need to enter an 'IF' statement that, if none of the facilities have an entry, nothing is created (that's easy, even I can do that), but...
If there is one or more of the facilities added, I want to create a div with an h4 header and with all the entries in.
What is the correct syntax for, in my case 14 possible entries?
Is there a way or adding all 14 Field Definitions to a single IF statement and if just one has an entry create the div etc.
Here's just one of the Field Definitions
Code: Select all
{if isset($entry->fields.BeerGarden) && $entry->fields.BeerGarden->value != ''}<div class="VBeerGdn row col-tweleve cf">{$entry->fields.BeerGarden->value}</div>
{/if}
Code: Select all
{if isset($entry->fields.Jukebox,LiveSportBigScreen,PoolTable,SnookerTable,DartBoard,FruitMachine,DisabledAccessToilet,SmokingArea,BabyChanging,DogFriendly,WiFi,CarPark,DanceFloor) && $entry->fields.Jukebox,LiveSportBigScreen,PoolTable,SnookerTable,DartBoard,FruitMachine,DisabledAccessToilet,SmokingArea,BabyChanging,DogFriendly,WiFi,CarPark,DanceFloor->value != ''}{/if}
