php - How to get the contents of a specific page from controller in CodeIgniter? -


i want create dynamic page using codeigniter framework. when click link, creates link depends on id. didn't show contents in page. showed "object not found." how can connect controller , view here?

$route['report/:any/:num'] = "home/reportcard";

here code:

  1. 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');   } 
  2. view created link depends on id:

    <div class="row">                     <ul class="home-grid">                         <?php foreach ($query->result() $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 see report</small>                             </a>                         </li>                         <?php endforeach; ?>                     </ul>  </div> 

for checking purpose in main.php view, added "hello world". didn't show anything. how can view?

https://www.codeigniter.com/user_guide/general/views.html check "creating loops" section

$data must array, can accessed in view like

foreach ($records $record) : 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -