[eluser]jcjc[/eluser]
I'm trying to load a view within a construct. I have a controller called company and I'm passing a url like company/xyz
I'm using uri_segment to get the requested company from the url and using it to query the database.
I can return the results perfectly - however I want to load a view and feed it the data. I get a 404 error: The page you requested was not found.
My controller is:
Code:
class Company extends MY_Controller
{
function __construct()
{
parent::__construct();
$companyName = end($this->uri->segment_array());
$this->db->where('CompanyNiceName', $companyName);
$query = $this->db->get('Company', 1);
$getCompany = $query->row();
//print_r($query);
$this->data['CompanyName'] = $getCompany->CompanyName;
$this->load->view('companyView', $this->data);
}
function index()
{
echo "no company data requested";
}
}
in my view I have a straightforward:
Code:
<?php echo $CompanyName; ?>