Welcome Guest, Not a member yet? Register   Sign In
Constructor Not Working
#1

[eluser]oldrock[/eluser]
Hi ..,

I am using constructor for the first time the following code is not working while giving the url:http://localhost/code/index.php/archives

<?php
class Archives extends Controller
{
function Archives()
{
parent::controller();
$this->load->view('head');
}

}

?>

thanks in advance
#2

[eluser]Atharva[/eluser]
Of course it will not work.
Code:
http://localhost/code/index.php/archives

This will look for index function in archives controller which you haven't written. You have to write index function in archives controller in which you will load the view.

Also, you should get your basics updated. Constructors are not meant for loading a view, they meant for constructing values (objects) that you may need in further processing.




Theme © iAndrew 2016 - Forum software by © MyBB