Welcome Guest, Not a member yet? Register   Sign In
Adding Dynamic Data To Views
#1

When I add my data the first $data array gets block by second data array

And I am unable to view the data in the first array

Any idea's whats causing it and how to solve it.


Code:
public function index($post_id) {
$post_data = $this->post_model->getpost($post_id);
        
$div_id = 1;

// First Array
$data = array(
   'title' => 'Welcome to CodeIgniter',
   'islogged' => $this->user_model->is_logged(),
   'username' => $this->user_model->getusername()
);

// Second Array
$data = array(
   'post_user_id' => $this->user_model->getuserid(),
   'post_title' => $post_data['subject'],
   'post_message' => $this->parsedown->text($post_data['message']),
   'post_id' => $post_data['post_id'],
   'post_div_id' => $div_id,
   'post_votes' => $post_data['votes']
);

$data['forum_id'] = $post_data['forum_id'];

$data['page'] = 'forum/post';

$this->load->view('default', $data);

}


Views > default.php


PHP Code:
<?php $this->load->view('template/common/header');?><?php $this->load->view('template/common/navbar');?>
<?php $this
->load->view('template/' $page);?>
<?php $this
->load->view('template/common/footer');?>
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply


Messages In This Thread
Adding Dynamic Data To Views - by wolfgang1983 - 01-18-2017, 08:30 PM
RE: Adding Dynamic Data To Views - by enlivenapp - 01-18-2017, 08:44 PM



Theme © iAndrew 2016 - Forum software by © MyBB