Admin area - Get config from database

Update at 2017-12-22 07:58:41


Introduce

In the article Admin area - Save config you have learned how to save a configuration, in this article, the document will guide you how to get them out.

Take over the Config_model

Config_model is a model that is configured autoload, so you will not need to load this model when you want to use it.

This model is located at /admin/models/Config_model

You will get the configuration information through the following structure

<?php
    // config name: email_contact
    // config namespace: config
    $email_contact = $this->config->model('email_contact', 'config');

You can also check if a configuration information exists or not via syntax

<?php
    // config name: email_contact
    // config namespace: config
    $has_email_contact = $this->config->has('email_contact', 'config');

Note: $this must be an instance of CI Base