Welcome Guest, Not a member yet? Register   Sign In
Tutorial − News section, help !!!
#9

[eluser]Unknown[/eluser]
If you want variables to be available in your view, you have to make sure they are assigned in your controller. So since the standard way to pass the variables to the view is with the $data array, you should have something like this in your controller

$data['news_items']['title'] = "Amazing Title";
$data['news_items']['text'] = "Lorem ipsum...";

When I started with CI that always confused me. Whatever you assign as $data['variable'] in the controller, is available as $variable in the view.

So you could even avoid having multidimensional arrays by doing your variables like ..

$data['news_item_title'] = "Amazing Title";
$data['news_item_text'] = "Lorem ipsum...";

Which would be available as $news_item_title and $news_item_text.


Messages In This Thread
Tutorial − News section, help !!! - by El Forum - 09-18-2012, 10:34 AM
Tutorial − News section, help !!! - by El Forum - 09-18-2012, 10:40 AM
Tutorial − News section, help !!! - by El Forum - 09-18-2012, 10:47 AM
Tutorial − News section, help !!! - by El Forum - 09-18-2012, 10:56 AM
Tutorial − News section, help !!! - by El Forum - 09-18-2012, 11:24 AM
Tutorial − News section, help !!! - by El Forum - 09-18-2012, 11:36 AM
Tutorial − News section, help !!! - by El Forum - 01-30-2013, 06:27 AM
Tutorial − News section, help !!! - by El Forum - 01-30-2013, 06:50 AM
Tutorial − News section, help !!! - by El Forum - 01-30-2013, 04:31 PM
Tutorial − News section, help !!! - by El Forum - 01-30-2013, 07:14 PM



Theme © iAndrew 2016 - Forum software by © MyBB