I want to create a dynamic page by using CodeIgniter Framework. When I click the link, it creates a link depends on id. But didn't show any contents in the page. Showed "Object not found." How can I connect controller and view here?
$route['report/:any/:num'] = "home/reportcard";
Here is my code:
-
controller:
public function index(){
$this->load->model("item_model"); $data['records'] = $this->item_model->getAllItems(); $this->load->view('home',$data); } function reportcard(){ $this->load->view('main'); }
-
view where created a link depends on id:
<div class="row"> <ul class="home-grid"> <?php foreach ($query->result() as $row): ?> <li> <a href="<?php echo base_url() ?>report/<?=$row->item ?>/<?=$row->id ?>" class="btn btn-lg btn-warning view-report"><span class="glyphicon glyphicon-list-alt"></span> <br/> <?=$row->item ?><br/> <small>Click here for see report</small> </a> </li> <?php endforeach; ?> </ul> </div>
For checking purpose in my main.php view, I just added "Hello World". But it didn't show anything. How can I get the view?