Welcome Guest, Not a member yet? Register   Sign In
error in included file
#1

[eluser]Uplift[/eluser]
In my view of each page i include header.php at the top instead of including it in every page.

however i've run into a problem.

i run the following code to check if the visitor is logged in

Code:
<? if($this->vbulletin->hasSession()) {

   echo "is logged in";

} ?>

if i put this in the included header.php it throws an error:

Using $this when not in object context in /home/ubuzznet/public_html/aaa/application/views/header.php on line 51

i can put the same code in the actual view file and the code works fine as it echos 'is logged in'

Why would it not work in the included header file, is there a way around this?
#2

[eluser]johnpeace[/eluser]
Have you tried:

Code:
$this->load->view('header');
#3

[eluser]Uplift[/eluser]
[quote author="johnpeace" date="1346161197"]Have you tried:

Code:
$this->load->view('header');
[/quote]

perfect thanks Smile




Theme © iAndrew 2016 - Forum software by © MyBB