• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Taking full advantage of CI

I've been using CI for about 6 months now and I don't think I'm really taking full advantage of it. I was wondering if there were any good books/articles that really explain how to take full advantage of CI and how to use controls and models. One of the main thing that seems to limit me the most is how I want my URL to look. One of the projects I'm currently working on I'm trying to make my URLS look something like this /school/sport/game where each segment of the URL is a variable. When I do something like this I loose features of having multiple controllers or even a control at all really. I've read about the _remap function and this might be what I need, however I would still be interested in what everyone else in the CI community has to say.

If you are only going to have school names as the first segment of your URI sting, have you taken a look at routing to maybe solve that? You can find the user guide info here.

The way you could do that is:

1. You have a controller that handles the first variable, lets call it schools.php.

2. You make a route that says

$route[':any'] = "schools";

3. In your schools index function, you have it pull the name of the school from the first URI segment using the URI helper:

$school = $this->uri->segment('1');

Then you can take the other variables from URI string (segments 1 and 2) and put together page content that way.

If you have other first segment values that you need to use, you can just have a controller called Schools and take the 2nd uri string value. Then your urls would look like this:


As for getting into Code Igniter deeper, I've found three things have really helped me get to know it better:

a. When you have something you are going to write a script for, check and see if Code Igniter does it, or how you can do it easier with Code Igniter

b. Read through the user guide's list of libraries and helpers - there is stuff I found in there I wish I knew when I started out with it!!

c. Make sure you get the way that these work together:


If you don't get it now, a few months coding with CI makes it pretty clear!

About books/articles: i think CodeIgniter User Guide and CI forum is best.
/school/sport/game: First one should be controller name and second one is function name. So if you wish to use these as variable then you have to add controller and function name in first two segment.
I might not able to help you exactly..... Sad

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.