Help with planning a CI project |
[eluser]theprodigy[/eluser]
you can do that, but you would need to either setup a route for it in your routes config file, or add another function to your page class named about-us, or add a _remap function. routes example (I believe that should do it, although I may be wrong): Code: $route['default_controller'] = "page"; about-us example: Code: function about-us($page) { _remap (I personally don't use this a lot, but you can read about it here)
[eluser]invision[/eluser]
Thanks for the reply. Aaaah so in my Pages Controller, I should have functions for all my 'directories' like 'about-us','services' etc? Great, I will test this example out in a second if you're not rushing off ![]() Thanks again
[eluser]theprodigy[/eluser]
If you want something other than "pages" to display in the url (like your about-us), then yes, you would need any one of the options i listed above, since you would be altering the default behavior of CI (domain.tld/controller/method/params).
[eluser]invision[/eluser]
Just a headsup. I don't think CodeIgniter likes the hyphen in about-us. Any way to fix this, or should I just go with aboutus instead?
[eluser]theprodigy[/eluser]
you could change the hyphen to an underscore, but I'm not sure why CI would have a problem with the hyphen. What error is it throwing?
[eluser]invision[/eluser]
Brilliant! Ive temp changed about-us to aboutus in my Page controller. Think I'm almost there with this. However, when I visit: http://www.site.com/index.php/page/aboutus/location I'm getting these 3 error messages: Code: A PHP Error was encountered Code: A PHP Error was encountered Code: A PHP Error was encountered Any ideas what may be causing this?
[eluser]theprodigy[/eluser]
those errors are coming from your views. It sounds like you are trying to access indexes in an array that don't exist.
[eluser]invision[/eluser]
Do you want me to post my current Model / Controller / View code for the Pages area of my site? Really appreciate all your help with this, feel like I'm making a great dent in this so far.
[eluser]invision[/eluser]
Controller Code: <?php Model: Code: <?php Views: Code: <?php Code: // template.php Many thanks for all your help again ![]() |
Welcome Guest, Not a member yet? Register Sign In |