Reputation: 265
I have a controller to send data to a index page of php in my codeigniter application as shown
this is the snippet of code from the controller
I have added an echo which I can see from the console
EDITTED
this is the beginning of the index controller
<?php if(! defined("BASEPATH")) exit("no direct acces to script");
//this is the index
class Index extends CI_Controller
{
}
function index()
{
echo("Am here");
if($this->session->userdata("user_public_id"))
{
$user_id = $this->session->userdata("user_public_id");
}
else
{
$user_id = "0";
}
</div>
<?php endforeach; ?>
I cannot figure out why is my page showing no content. Kindly assist me in debugging this
Upvotes: 1
Views: 105
Reputation: 406
@parker As per your code, the index() function is placed at outside of the controller, it should be inside in the Index Class, like this
<?php if(! defined("BASEPATH")) exit("no direct acces to script");
//this is the index
class Index extends CI_Controller
{
function index()
{
echo("Am here");
if($this->session->userdata("user_public_id"))
{
$user_id = $this->session->userdata("user_public_id");
}
else
{
$user_id = "0";
}
.
.
.
.
}
?>
If the problem still exist, please do change the name of the controllerIndex to Something else!
This may helps you..thanks!
Upvotes: 1