Custom Routing and common header/footers |
[eluser]Unknown[/eluser]
Hi, I'm fairly new to the CI scene (I started last week) - and I've learnt some useful things that I thought I might share with the community. I wrote the whole thing up on a blog post: http://remysharp.com/2008/03/25/codeigniter/ However, I wasn't sure if there was some place this code should be uploaded to... The two big things I solved were this: 1) Custom URL routing. I searched the forums, and found people with the similar problem that they wanted to direct 404s to a custom controller to check a database table before deciding the final destination of the process flow. I found that I could subclass the Router and overload the _validate_request method to make this work perfectly. 2) Common header / footers I had gotten used to the features of my old PHP framework, where I never had to specify the header and footer, nor that they should be ignored in Ajax requests - and I eventually worked out that I could subclass the Controller and use my own to reduce the amount of code I would need in each controller. I would really appreciate any feedback, or criticism anyone might have. The files I used are available from the blog post. Thanks, Remy Sharp. |
Welcome Guest, Not a member yet? Register Sign In |