Welcome Guest, Not a member yet? Register   Sign In
$CI =& get_instance() fails in error_404.php for some URLs
#1

[eluser]Russ Back[/eluser]
Hi,

Bit of an odd one this. I have my 404 redirection working fine in most circumstances but the following URL produces an error:

Quote:/.....

Obviously that's a daft URL and one that I'd hope wouldn't ever occur but I'm always keen to ensure I capture all errors. Here's what I'm getting:

Code:
A PHP Error was encountered

Severity: Notice

Message: Trying to get property of non-object

Filename: errors/error_404.php

Line Number: 9

Line 9 has this code:

Code:
echo($($CI->config->item('site_name')));

And before that I'm setting $CI as usual:

Code:
$CI =& get_instance()

Anybody ever come across this before?
#2

[eluser]wiredesignz[/eluser]
Try:
Code:
$CI =& get_instance();
#3

[eluser]Russ Back[/eluser]
Sorry that was a typo, I do actually have that code in place and have edited the original post!

Code:
$CI =& get_instance()
#4

[eluser]wiredesignz[/eluser]
Maybe you could explain why you are trying to convert the site name into a variable in the example?

Otherwise you can try:
Code:
<?php echo config_item('site_name'); ?>
#5

[eluser]Russ Back[/eluser]
I was trying to use CI's config class like this:

Code:
echo($CI->config->item('locality', 'uk_hcard'));

However with that suggestion, as far as I can see I need to do this:

Code:
$hcard = config_item('uk_hcard');
echo($hcard['locality']);

Does that make sense?




Theme © iAndrew 2016 - Forum software by © MyBB