Controller not working as expected |
[eluser]StefanAlexandru[/eluser]
Hi everyone, I am new to CI, and I am trying to build up a classified site , so I've just encountered a problem which I couldn't understand. So here is my code : Controller : Code: <?php Model: Code: class General extends CI_Model { So, when I am calling the controller like this : http://www.domain.net/subdomain/ads/10/ I am getting a 404 error, but if I make a new function, not putting all the code in the index function, everything is working fine. So my question is : Why I can't perform that actions in the index function of the controller ? It wouldn't be a real problem but it's for seo purposes to have Code: http://www.domain.net/subdomain/ad/10/ Code: http://www.domain.net/subdomain/ads/function/10/ Thanks in advance and sorry for my bad english.
[eluser]danmontgomery[/eluser]
Default controller is only called when one isn't specified. In your example, you're specifying the "10" method, which doesn't exist. You can get around this with routing, which is detailed in the user guide.
[eluser]StefanAlexandru[/eluser]
Thanks for your fast reply, so this is how i've made it, maybe others will encounter this problem too: routes.php Code: $route['ad/:num']= '/ad/adbyid'; controller: Code: <?php
[eluser]StefanAlexandru[/eluser]
What do you exactly mean by naming convention on models ? instead of General should i use Generalmodel or General_model ? LaterEdit: Ok :-) |
Welcome Guest, Not a member yet? Register Sign In |