Welcome Guest, Not a member yet? Register   Sign In
Codeigniter within existing site
#1

[eluser]suppster[/eluser]
Hi, I am trying to include a codeigniter comments section within certain pages of an existing site. I am using the following to include the codeigniter snippit:
Code:
echo $directoryLevelPrefix . "staff/codeigniter/index.php";
                            $_SERVER["REQUEST_URI"] = "comment/index2/".$page;
                            require_once($directoryLevelPrefix . "staff/codeigniter/index.php");

This works fine normally, but when I put the code in a function and call it I get the following error:
Quote:Fatal error: Call to a member function item() on a non-object in \codeigniter\system\core\Utf8.php on line 47

I guess codeigniter must be taking some details from the calling page which are out of scope in the calling function. Any ideas how to do this?
#2

[eluser]toopay[/eluser]
Before you can use any of CI Instance/object, outside the CI Controller or model you must first declare
Code:
// This will be generates error if you put it outside CI Controller or CI Model scope
$this->load->library('some_ci_library');
// Declare CI instance first
$CI =& get_instance();
$CI->load->library('some_ci_library');




Theme © iAndrew 2016 - Forum software by © MyBB