How would I call a controller inside the view? When I use the code below, I'm limited with Html and CSS formatting. I could use jQuery JSON, but that's added work. Any ideas?
<?php
class home extends CI_Controller {
function __construct() {
parent::__construct();
}
function displayList() {
$query = $this->db->query("SELECT * FROM data");
foreach ($query->result() as $row) {
echo $row->title . "<br>";
echo $row->text;
}
}
function index() {
$this->load->view('home');
$data['lists'] = $this->displayList();
}
}
?>