Well with my CMS I am building I was able to purchase a really nice admin template from theme forest and I’m trying to figure out how to accomplish the themeing/templating.
Login Page Here: http://www.kansasoutlawwrestling.com/admintemp/login.html
Control Panel: http://www.kansasoutlawwrestling.com/admintemp/index.html
Now most of the files are the same however I’m going to be using the Tank Auth library for my user login and authentication which includes the registration and forgot password form, etc.
I want to be able to use the same layout, template, theme whatever is the proper term for those authenitcation forms because if you notice on the login page there’s a body class of login which complicates things a little.
Or is there a better way to accomplish this without a templating library or even is there a better library that I should use?
Anybody have any ideas?
Newest Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Welcome extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see http://codeigniter.com/user_guide/general/urls.html
*/
public function __construct()
{
parent::__construct();
$this->load->helper('url');
$this->load->library('tank_auth');
}
public function index()
{
// Set up the template.
$this->template->set_layout('default')->enable_parser(false);
if (!$this->tank_auth->is_logged_in()) {
redirect('/auth/login/');
} else {
$data['user_id'] = $this->tank_auth->get_user_id();
$data['username'] = $this->tank_auth->get_username();
$this->load->view('welcome', $data);
}
}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
FIXED THIS ISSUE
One of the most basic ways of templating a site in CodeIgniter is to create a template or “layout” php file that dynamically loads another view file.
Try something like this and see if it works for you:
views/layout.php
views/header.php
views/footer.php
views/login.php
controllers/welcome.php