[eluser]Body[/eluser]
Hello.
Sorry for my english and sorry if this question have been asked already - my research was not successfull.
Look, i want to use some block of view-code in many parts of my website.
Imagine for simplify i have this data:
Code:
$this->load->library('RatingCounter');
$content['blogEntries'] = array(
0 => array(
'id' => 5,
'title' => 'Some title',
'content' => 'Some content',
'User' => array (
'id' => 2,
'nickname' => 'body',
'points' => '25'
)
),
1 => array(
'id' => 6,
'title' => 'Some title 2',
'content' => 'Some content 2',
'User' => array (
'id' => 3,
'nickname' => 'test',
'points' => '13'
)
)
);
$this->load->view('blog_view', $content);
In this view file i have this loop:
Code:
<?php foreach ($blogEntries as $blogEntry): ?>
<h1><?=$blogEntry['title']?>></h1>
<!-- USERINFO: This code i want to use in other views, i need to load it dynamic -->
Username: <?=$blogEntry['User']['nickname']?><br />
Rating: <?php echo $this->ratingcounter->get_rating($blogEntry['User']['points']); ?>
<!-- /USERINFO -->
<br /><br />
<?php endforeach; ?>
So, i want to use userinfo-block code in other pages too. How can I use this userinfo-block code in this page and in other pages? Note, that i use
$this->ratingcounter->get_rating() function here, so i can't just use helpers.
Thanks for advices.