CodeIgniter Forums
Has a problem from php4 upgrade to php5 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Has a problem from php4 upgrade to php5 (/showthread.php?tid=8945)



Has a problem from php4 upgrade to php5 - El Forum - 06-06-2008

[eluser]benyu[/eluser]
taking a look at my scripts first, please!

class BaseController extends Controller
{
var $menus = array();

function BaseController()
{
parent::Controller();
}

function RenderMenu()
{
//todo.
}
}

class FrontController extends BaseController
{
function FrontController()
{
parent::BaseController();
$this->__init_menus();
}

function __init_menus()
{
//todo
}

}

// a front controller page
class Home extends FrontController
{
function Home()
{
parent::FrontController();
}

function index()
{
$this->load->view('home');
}
}

// a view file home.php
<?php $this->RenderMenu();?>

the script running okay in php4 (APACHE)!
but it's told me a error in php5:

Fatal error: Call to undefined method CI_Loader::RenderMenu() in ...


Has a problem from php4 upgrade to php5 - El Forum - 06-06-2008

[eluser]wiredesignz[/eluser]
The view is generated by CI_Loader which is part of Controller in PHP4 but is seperate object in PHP5.

$this->... refers to ci_loader in PHP5 not controller