Added config_helper.php class for fetching the configuration values in templates.

This commit is contained in:
alext 2018-01-15 08:57:17 +01:00
parent 76dfb70685
commit fb8aea0c3e
3 changed files with 27 additions and 2 deletions

View file

@ -64,7 +64,7 @@ $autoload['libraries'] = array('database');
| $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array('custom_exceptions', 'url', 'file', 'language', 'asset');
$autoload['helper'] = array('custom_exceptions', 'url', 'file', 'language', 'asset', 'config');
/*

View file

@ -0,0 +1,25 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/* ----------------------------------------------------------------------------
* Easy!Appointments - Open Source Web Scheduler
*
* @package EasyAppointments
* @author A.Tselegidis <alextselegidis@gmail.com>
* @copyright Copyright (c) 2013 - 2017, Alex Tselegidis
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
* @link http://easyappointments.org
* @since v1.3.0
* ---------------------------------------------------------------------------- */
/**
* Quickly fetch the value of a framework configuration.
*
* @param string $key Configuration key.
*
* @return mixed Returns the configuration value.
*/
function config($key) {
$framework = & get_instance();
return $framework->config->item($key);
}

View file

@ -324,7 +324,7 @@
var GlobalVariables = {
availableServices : <?= json_encode($available_services) ?>,
availableProviders : <?= json_encode($available_providers) ?>,
baseUrl : <?= json_encode(base_url()) ?>,
baseUrl : <?= json_encode(config('base_url')) ?>,
manageMode : <?= $manage_mode ? 'true' : 'false' ?>,
dateFormat : <?= json_encode($date_format) ?>,
appointmentData : <?= json_encode($appointment_data) ?>,