Welcome Guest, Not a member yet? Register   Sign In
Is there a way to pass every variable in a controller action, to the view automatical
#2

(This post was last modified: 06-16-2017, 03:57 PM by reactionstudio.)

this isn't quite how i do it but you could do something like:

PHP Code:
<?php
class News extends CI_Controller {
        
        private 
$data = array();

 
       public function index()
 
       {
 
               $this->data['stories'] = $this->News_story->get_list();
                
$this->load->view('common/wrapper',$this->data);
 
       }

 
       public function story($news_story_id)
 
       {
 
               $this->data['story'] = $this->News_story->get($news_story_id);
                
$this->load->view('common/wrapper',$this->data);
 
       }

Reply


Messages In This Thread
RE: Is there a way to pass every variable in a controller action, to the view automatical - by reactionstudio - 06-16-2017, 03:50 PM



Theme © iAndrew 2016 - Forum software by © MyBB