![]() |
URL method - 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: URL method (/showthread.php?tid=26742) |
URL method - El Forum - 01-21-2010 [eluser]Dr. x[/eluser] hi every one. am new here on codeigniter and glade for that, so many thanks for all it's team work. am covert from already building script into MCV and i know hot to make the url same to "class/function/id" but i want to make small modification to the url to be as that "class/function/constant_id" so the variable that will pass to the function is only $id not constant_id i will appreciate for any help and so sorry for my english Best Regards URL method - El Forum - 01-22-2010 [eluser]Dr. x[/eluser] any help here please ?? URL method - El Forum - 01-22-2010 [eluser]n0xie[/eluser] I don't really understand the question. Could you perhaps explain it with a few examples? URL method - El Forum - 01-22-2010 [eluser]Dr. x[/eluser] thank you n0xie for replay. the question is how to change the url method from shape to another shape ex. : blog/view/id , so as i understand the controller is "blog" and the function will be "view($id)" and the parameter will pass to the function is id ="$id". and i want it to be as blog/view/article_id and then "article_" will be constant for example : blog/view/article_1 or blog/view/article_1234 so just the number "1234" which will pass to the function not "article_1234". i hope you got me, and sorry again for my English best regards URL method - El Forum - 01-22-2010 [eluser]n0xie[/eluser] Aah you want to have this url? Code: blog/view/artice_$id You could either do it with routes: Code: // application/config/routes.php OR just strip the 'article_' part from the passed parameter: Code: function view($id) URL method - El Forum - 01-22-2010 [eluser]Dr. x[/eluser] woow thank you so much for help with that great idea. can i ask you a question please ? what if some one write missing character on the url ?are the url will give 404 or will redirect to the original one ? for example let say i write the url at the browser as that : exmple.com/index.php/blog/view/aticl_1 are that will give 404 or will return the data of exmple.com/index.php/blog/view/article_1 ? and are that url like will help on search engine or will be no effect ? est Regards URL method - El Forum - 01-22-2010 [eluser]Dr. x[/eluser] mmm, i dont know why after i use the route the all pages give me blank page ! and if it remove the route line it work back! any suggest ? |