Welcome Guest, Not a member yet? Register   Sign In
Sending content from Controllers to Views
#1

[eluser]Alexisu[/eluser]
Hello,

I'm sending a link from my Controller to my View page, as follows:

my controller....

Code:
<?php

class Test extends Controller {

    function index()
    {
        $data['info'] = array('<a href="/folder/something/">Link Title</a>', 'Text');
        $this->load->view('my_view', $data);
    }

}
?&gt;

my_view page....

Code:
<ul>
     &lt;?php foreach($info as $item): ?&gt;
         <li>&lt;?=$item?&gt;</li>
     &lt;?php endforeach; ?&gt;
</ul>


I'm just getting started with PHP & Codeigniter & I'm sending a lot of data such as this straight to my views from the controller. Furthermore, from my views, I load paragraph text from other nested views.

My question is: Is the above normal practice, or would the 'Model' ideally be involved, or a 'Helper' be used (perhaps for the link)? I'm trying to make sure my content/data is where it should be.

Any tips/advice would be appreciated!

Thanks.

Lex


Messages In This Thread
Sending content from Controllers to Views - by El Forum - 01-20-2011, 10:22 AM
Sending content from Controllers to Views - by El Forum - 01-20-2011, 08:16 PM
Sending content from Controllers to Views - by El Forum - 01-21-2011, 05:54 PM
Sending content from Controllers to Views - by El Forum - 01-21-2011, 07:31 PM



Theme © iAndrew 2016 - Forum software by © MyBB