![]() |
foreach in view, what am I doing wrong - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: foreach in view, what am I doing wrong (/showthread.php?tid=38101) |
foreach in view, what am I doing wrong - El Forum - 01-30-2011 [eluser]Unknown[/eluser] Hi ! I'm new to CI and PHP framework globaly. I'm having an issue making a loop to display news in my view. Code: <?php foreach($news as $row => $val): ?> These to echo displays the SAME thing (Oo ?) : "this is the title : title; ?>" instead of the real title. Moreover, when I do the same directly in my controller, it works flawlessly... The error only is in th view, and I don't get why. For info : Controller : Code: $this->load->model('News_model', '', TRUE); Model : Code: function get_last_x_entries($x) Thanks in advance. foreach in view, what am I doing wrong - El Forum - 01-30-2011 [eluser]mi6crazyheart[/eluser] Hmmm, every things seems all right. Ok try this in u'r VIEW & tell me working or not... Code: <?php foreach($news as $val): ?> foreach in view, what am I doing wrong - El Forum - 01-30-2011 [eluser]InsiteFX[/eluser] Maybe use <?php InsiteFX foreach in view, what am I doing wrong - El Forum - 01-30-2011 [eluser]artallan[/eluser] Code: <?php foreach($news as $row => $val): ?> use proper php tag, Code: <?php echo $val->title; ?> Code: <?=$val->title?> |