jcadima
10/7/2015 - 9:37 PM

Global settings Controller

Global settings Controller

<?php
// application/core/MY_Controller.php

class  MY_Controller extends CI_Controller {
	public function __construct ( ) {
		parent::__construct() ;

		// Loop to get  all settings in the "globals" table,
		// this will enable us to use:
		// $this->global_data['site_title']   anywhere in the application
		// get the array object result from  get_global_settings
		/*
		$results results in an array of object which are identified as:
		$result->key and $result->value  and  this key and value are stored in 
		an array global_data[] which is used on home.php
		*/
		foreach ( $this->Settings_model->get_global_settings() as $result ) {
			$this->global_data[$result->key] = $result->value;
		}


	}
}