Jump to content

Header templating help


brettski

Recommended Posts

Hi there, ok I'm stuck...

 

I need to show different headers for certain pages on my website, My template file below calls in all template parts with the 'layout' file being the file which includes a simple html header and menu. How would I go about this? Would I need to create and call on a seperate/second layout file eg. layout2 or can I determine which header shows on certain pages by adding some code to the layout file itself.

 

Any help greatly greatly appreciated.

<?php

class Templating extends Model{
function __constructor(){
}


function show($center = 'homepage', $right = 'login_box', $left ='left/search_panel', $template = 'layout'){
	$data = array(
		'right_bar' => $right,
		'left' => 'left/search_panel',
		'center' => $center,
		'left_logged'=>'left/user_panel'

	);
	if ($this->session->userdata('logged_in') == true){

		if ($this->session->userdata('admin')){
			#$data['right_bar'] = 'right_panel/admin_panel';
			$data['left_logged'] = 'right_panel/admin_panel';

		}else{
			#$data['right_bar'] = 'right_panel/user_panel';
			$data['left_logged'] = 'left/user_panel';
			//$data['left']      = 'left_panel/user_panel';
		}
	}else{
		#$data['right_bar'] = 'right_panel/login_box';
	}


	$this->load->vars($data);
	$this->load->view($template);
}


function show_non_live(){
	$data = array(
		'left' => 'left/search_panel',
		'center' => 'center/list_companies',
		'left_logged'=>'left/user_panel'
	);
	if ($this->session->userdata('logged_in') == true){
		if ($this->session->userdata('admin')){
			//$data['right_bar'] = 'right_panel/admin_panel';
			$data['left_logged'] = 'right_panel/admin_panel';
		}else{
			//$data['right_bar'] = 'right_panel/user_panel';
			$data['left_logged'] = 'left/user_panel';
		}
	}else{
		#$data['right_bar'] = 'right_panel/login_box';
	}
	$template = 'layout';
	$this->load->vars($data);
	$this->load->view($template);
}
}

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.