if statement within an array

3 posts by 2 authors in: Forums > CMS Builder
Last Post: September 18, 2017   (RSS)

By Mikey - September 18, 2017

Anyone have suggestions on how to get an if statement to work within an array?

Below is a snippet of code showing what I'm trying to accomplish... thought what I have fails to work, but I think you'll get the idea.

    $sectionsToField = array(
        'news'                => 'title',
        'media'                => 'name',
    if ($site_settingsRecord['enable_events'] =='1' ) {
        'events'             => 'title',
    }
        'about'                => 'name',
        'products'            => 'name',
        'services'            => 'name',
    );

Thanks for any suggestions,

Zicky

By Mikey - September 18, 2017

Thanks Dave - works like a charm!