Web Hosting Talk







View Full Version : Fatal error: Using $this when not in object context


Flumps
08-11-2007, 11:22 AM
I am using codeIgniter to help with my php website, I am just wondering if somone could help me with this line of code as im at a blank am I missing to do somthing here :-s

Fatal error: Using $this when not in object context in /home/user/domains/domain/public_html/system/application/views/header.php on line 6

line 6 of the header.php file reads:

<link href="<?=$this->config->item('base_view');?>style.css" rel="stylesheet" type="text/css">

many thanks in advance.

bear
08-11-2007, 09:16 PM
Poked around Google and found this:
http://www.webmaster-talk.com/php-forum/43174-fatal-error-using-when-not-object.html
Might help you?

jmcgon
08-11-2007, 10:04 PM
<?=$this->config->item('base_view');?>

equals seems out of place

<?echo $this->config->item('base_view');?>

Flumps
08-12-2007, 01:52 AM
I thought i did search google but i was pressed for time that day. I will have another look tonight when I get out the office. thanks for your help peeps.

fastnoc
08-12-2007, 02:05 AM
This is probably a stupid question, but have you checked on their forums?
http://codeigniter.com/forums/

I use Ellis Lab stuff. Expression Engine. Great products

Flumps
08-12-2007, 01:01 PM
sorry for the long reply, I had thought about posting on their official forums but I thought id try my luck here first to save me sigining up for yet another community hehe lazy i know :P

if I dont get any joy remove the = then ill sign up hehe.

Flumps
08-12-2007, 01:15 PM
nope still didnt work ill give their official forums a whirl

killapix
08-12-2007, 03:33 PM
May not be a permanent fix but try changing the $this to something else to see if the error disappears say ...$that for instance. If the error goes its because you are using php5 and $this is a predefined identifier in PHP5 and cannot be used as a var name or parameter..

Flumps
08-12-2007, 05:34 PM
says $that is not defined. :-s ill post on the official forums :P