Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14348

Adding Dynamic Data To Views

$
0
0
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');?>

Viewing all articles
Browse latest Browse all 14348

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>