3 Easy Steps to Integrate Codeigniter with AdminLTE

This post is also available in: Indonesia (Indonesian)





Halo sobat TA,

Dizzy how to integrate codeigniter with LTE Admin..?

Already googling here and there the results are zero…?

just up to here, okay,,,this time it will work,..

Just go ahead,,

 

Step 1. Download Codeigniter dan Admin LTE

I’m sure everyone already knows a lot where to download these two frameworks, but for those of you who don’t know, please download here

codeigniter https://www.codeigniter.com/download

AdminLTE  https://github.com/almasaeed2010/AdminLTE/releases

After downloading, we first extract the codeigniter file into C: \ xampp \ htdocs

then rename the folder to Ci-adminLTE (or you can choose as you like)

then extract the LTE Admin file in the assets folder, codeigiter C: \ xampp \ htdocs \ Ci-adminLTE \ assets.

open the config file in the config folder C: \ xampp \ htdocs \ Ci-adminLTE \ application \ config

url base settings in accordance with the project name temen2

$config['base_url'] = 'http://localhost/Ci-adminLTE';



Step 2. Create a Template Library

To be able to integrate these two frameworks, we need a library.

create a file with the name Template.php in libraries C: \ xampp \ htdocs \ Ci-adminLTE \ application \ libraries

The following code:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Template { var $template_data = array(); function set($name, $value) { $this->template_data[$name] = $value;
		}

		function load($template = '', $view = '' , $view_data = array(), $return = FALSE)
		{
			$this->CI =& get_instance();
			$this->set('contents', $this->CI->load->view($view, $view_data, TRUE));
			return $this->CI->load->view($template, $this->template_data, $return);
		}
}

then open the autoload.php file located in the config folder C: \ xampp \ htdocs \ Ci-adminLTE \ application \ config

then register the template library that we created by filling the array libraries, like this

then we also register the helper url like this

then Copy the index.html file in the AdminLTE folder

C: \ xampp \ htdocs \ Ci-adminLTE \ assets \ AdminLTE \ index.html

into the view folder and change the name to template.php

C:\xampp\htdocs\Ci-adminLTE\application\views\template.php

Next open the template.php file that has been moved then add this code

<?php echo base_url(); ?>assets/AdminLTE/

on each link..

example :

before adding

After added

Step 3. Time to Integrate

Open the Welcome.php controller file in the controller folder

C: \ xampp \ htdocs \ Ci-adminLTE \ application \ controllers

then change the code to be like this

<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Welcome extends CI_Controller { public function index() { $this->template->load('template','welcome_message');
	}
}

If it works then the appearance will be like this

if still not successful don’t give up huh,, try to repeat maybe someone missed…

if already repeated again it still fails too,,

download here, just use the source code :

Link Download : CI-AdminLTE

If you have questions, you can cross them out in the comments column,,

most importantly don’t forget to share,,, 🙂

thanks,,

 

Leave a Reply

Your email address will not be published. Required fields are marked *