I am only getting a white screen for the following code when i go to localhost/Home/Careers
NOTE: When I have the view_name.php file in the views folder, i get white screen of death. If I delete view_name.php from the views folder, I see the "test" and a "cannot find file error".
Any ideas?
<?php
if (!defined('BASEPATH'))exit('No direct script access allowed');
class Home extends CI_Controller {
public function Careers()
{
echo "test";
$this->load->view('view_name');
}
}
Probably because you are not mentioning "projectname" before controller name in browser.
Please try in browser with localhost/Project_name/Home/Careers
I solved the problem!
File permissions were wrong ! I did a chmod 755 on the php file and it works perfectly.
Chmod 755 filename.php
> > **In Controller:**
<?php if (!defined('BASEPATH'))exit('No direct script access
allowed');
class Home extends CI_Controller {
public function Careers()
{
$data['test']="test";
$this->load->view('view_name', $data);
}
}
> > In **view_name.php:**
<?php
echo $test;
?>