Attention Expert users: What are the things you wish you knew about CI when you started?

Hi Guys,

I am about to start my first project with CI, and I want to know if there are things to watch out for or nice shortcuts that you used to get ci working nicely with your app.

Basically what do you wish you knew when you first started...

i'll say better php skills Smile

see ya around

[eluser]Derek Allard[/eluser]
I've written about this (or sort of about this Wink) a few times. Maybe one of these will be helpful?

Welcome to CI codeamanny!

[eluser]Pascal Kriete[/eluser]
I slept on this, 'cause I couldn't think of anything yesterday. I can't today either.

I will agree with sikkle, a good grounding in the concepts helps. So if you're familiar with PHP and the MVC paradigm, you'll be in love instantly. If you don't, it'll take a good two days longer.

Other than that, I looked at a lot of code. InkType and BambooInvoice are both great examples of what's possible with CI, and they outline some good practices that the user guide just cannot teach you.

Good luck, have fun, and welcome to CI.

Keep it simple and flexible.

One suggestion I will make is to walk the framework. By that, I mean create a simple Hello World and follow the application from the bootstrap all the way through to output - constantly referencing the source files. This will give you a solid understanding of how requests are processed and of the dispatch loop and its pluggable architecture.

Learn how best to make the MVC concept work for you. Yes see how others use it but find a way to like and understand.

But the big think I wish I had known before. Why did no one tell me about this before. Why did I have to wait till now to find such a great framework.

[eluser]John Fuller[/eluser]
If I would have known she was going to slap me...

Er wait, what was the question again?

I can't really think of anything. Look through the ignited code section to see what has been built for CI before you try to reinvent something that has already been created.

Thanks for the advice guys... keep it coming.. this is so useful. (and the comments are entertaining too!)

Retrieving Models From A View

I had some issues with MVC and thought that you could not call a model method from a view (I was quite adamant this was incorrect). However MVC suggests you can as long as you do not alter the models data. An example of when this might be useful is if multiple controllers call the same view, you will not have to access the models method in every controller to retrieve the models method data.

Calling Other Model Methods Within Models

You can also call other models methods from a model. An example might be a customer model method might need to access a method from the user model. to do this you can load the user model in the customer models constructor.

class Customersdb extends Model
   * The Initialisation method

  function Customersdb()

  function removeCustomer($id)
    $query = $this->usersdb->removeCustomerUsers($id));

or use the CI instance which means you only need to load the model when the correct method is called.

class Customersdb extends Model
    private $CI;
    function Customersdb()
        $this->CI =& get_instance();    
    function removeCustomer($id)
mind you this might of been fixed in 1.6.x

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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