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