Welcome Guest, Not a member yet? Register   Sign In
Function requires table data
#1

[eluser]Unknown[/eluser]
Hello,

How can I pass a functions data into a view if it requires the table data in the views foreach loop.

e.g view_index.php

Code:
foreach ($posts as $post) {
if (has_subscribed($post->id)) {
echo "has subscribed";
}
}

Now obviously I can't place that function in my view?
So how do I pass that data from my controller to my view?
#2

[eluser]Sudz[/eluser]
Hi,

While loading views in your function add second parameter as an array.

Code:
$data['posts'] = '' // here your table data will be there
$this->load->view(' your view file',$data);




Theme © iAndrew 2016 - Forum software by © MyBB