one parameter to index() function ;) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: one parameter to index() function ;) (/showthread.php?tid=27213) |
one parameter to index() function ;) - El Forum - 02-03-2010 [eluser]rockstyle[/eluser] I've been trying to use this like urls, but i suppose it doesn't work. I'm newbie on this and i followed phpandstuff CI & Doctrine tutorial Code: <?php All i need is to use urls that will provide argument to funcion index($param); The parametr which will allow me to select one row in table category. In example i go to url localhost/ci/waiting that makes content is gathered from category 'waiting' that has some ID... and like that for all categories. For not specified category, like url: localhost/ci/ This goes for example to default category... @edit: This ... Code: ->find($category); one parameter to index() function ;) - El Forum - 02-03-2010 [eluser]theprodigy[/eluser] My answer below assumes that your base_url is "localhost/ci/". you are trying to shorten your url by leaving out both the controller and the method. I can give you an answer, but if your application needs more then 1 controller, it will be rather difficult to maintain. if you are looking for a way to pass in a category, without necessarily looking to shorten your url, you can always set a default in your function parameter: Code: public function index( $category="books" ) and then point the other links to "localhost/ci/home/index/[category to pass in]" If you want the other way, and are willing to take the extra work to maintain it, let me know. one parameter to index() function ;) - El Forum - 02-04-2010 [eluser]Colin Williams[/eluser] Look at the FAQ in the Wiki one parameter to index() function ;) - El Forum - 02-04-2010 [eluser]rockstyle[/eluser] would be good if i hadn't had o use htacces for shortening and manipulating urls... I just need to query wchich will allow me to get by address etc: localhost/ci/waiting localhost/ci/accepted <- waiting and accepted are in table category and it's the column called title. And second thing, how can i get rig of home/index/blablabla and use instead /blablabla, which will defintely be better. Thank you one parameter to index() function ;) - El Forum - 02-04-2010 [eluser]danmontgomery[/eluser] http://ellislab.com/codeigniter/user-guide/general/routing.html |