wiki:CodeigniterTime_Gui

Time_gui Library

Time_gui is a CI library that accepts various data as input and is responsible for rendering the GUI.

It was designed to eliminate redundant code, and is meant to be used only in controllers. The full API reference can be (eventually) found in the user guide located at base_url()assets/docs/user_guide

Old way:

	
<?php

...

	$data['title'] = 'TIME - Admin Control Panel';
	$data['header'] = $this->load->view('header', $data, TRUE);
	$data['username'] = $this->users_model->get_uname_by_uid($this->user_id);
	$data['content'] = $this->load->view('admin_page', $data, TRUE);
	$data['footer'] = $this->load->view('footer', $data, TRUE);
			
	$this->load->view('app', $data);
			
...

New way:

	$this->time_gui->set_pagedata(
			array(
				'title' =>	'TIME - Admin Control Panel',
				'username'=>	$this->users_model->get_uname_by_uid($this->user_id),
				'content'=>	'admin_page'
						
			)
	);
			
	$this->time_gui->render();

You won't need to call $this->load->library(), it is automatically loaded in application/config/autoload.php

Things that rarely or never change, like header, footer have defaults set in the library, so all we usually have to set is content, title, (things that are largely dynamic).

The library is at application/libraries/Time_gui.php. Until I generate the full API reference, see the documentation in the class to know how to use it. The new code can be seen in action in the admins controller. Use this for any new controller functions you are working on. Once the GUI demo is done, I'll work my way back and replace the code in the other controllers.

Last modified 7 years ago Last modified on Mar 24, 2011, 11:28:05 PM