some ci questions - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: some ci questions (/showthread.php?tid=9608) |
some ci questions - El Forum - 07-01-2008 [eluser]chops[/eluser] i'm new to ci and I have a few questions. How would I excecute a bit of code like this in a view Code: <? $d = dir("/images/project"); Also, what would be the best way to include a global query (eg: latest news sidebar) into most pages? would i have to set the query up in every controller? surely not! thanks some ci questions - El Forum - 07-01-2008 [eluser]Nima A.[/eluser] Hi, 1. first, I don't think using native php coding is a good approach for views (esp. for control structures such as for,while, etc ... ), in these cases, php alternate syntax performs a bit faster and it's more readable , 2. you can retrieve data from your model and then pass it to view using controller 3. design and implement a model for your news that represents it's structure and call it in every method of every controller that you want, I don't think setting and creating queries in controller is a good approach ! some ci questions - El Forum - 07-01-2008 [eluser]louis w[/eluser] I think it's ok to iterate results (i would do it with a foreach thou) inside a view. |