How to pass parameter in "index" function? |
[eluser]Sinclair[/eluser]
Hi, I need to know if it is possible to pass parameters in the index function of the controller. My code is for Tag listing and I neet to have an URL like http:\\mysite.com\tag\here-is-the-tag How can I do this? This is my controller code that is not working: Code: <?php
[eluser]Shay Falador[/eluser]
The url http:\\mysite.com\tag\here-is-the-tag would get the Tag controller and here-is-the-tag method. If you want to pass it to the index use a route. Something like that: $route['tag/([^/]+)'] = 'tag/index/$1'; Goodluck!
[eluser]jedd[/eluser]
[quote author="Sinclair" date="1264866835"] I need to know if it is possible to pass parameters in the index function of the controller. [/quote] Okay - here's what you do. You read the [url="/wiki/FAQ"]FAQ[/url]. Sure, the question in the FAQ is actually worded: How do I pass parameters to a controller’s index() function? - so it's possible that if you searched for 'in "index"' or 'in the index' this might be why you didn't find it when you [url="http://codeigniter.com/wiki/How_to_ask_a_good_question/"]looked before asking[/url].
[eluser]Unknown[/eluser]
please check user guide before asking,, Just use remapping funtion call : http://ellislab.com/codeigniter/user-gui...#remapping Code: function index($pn_tag) just complete code above :cheese: |
Welcome Guest, Not a member yet? Register Sign In |