if statement within an array

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

By Dave - September 18, 2017

Hi Zicky, 

There are a few ways to do that.  The simplest might be to add it afterwards.  How about this:

    $sectionsToField = array(
        'news'                => 'title',
        'media'                => 'name',
        'about'                => 'name',
        'products'            => 'name',
        'services'            => 'name',
    );

    if ($site_settingsRecord['enable_events'] == '1' ) {
        $sectionsToField['events'] = 'title';
    }

Let me know if that works for you!

Dave Edis - Senior Developer
interactivetools.com

By Mikey - September 18, 2017

Thanks Dave - works like a charm!