sooglejay
sooglejay

Reputation: 1375

What's the difference between "Load a helper in a specific function that needs it'' compared to ''adding the helper to the autoload array"

CodeIgniter Question:
What's difference between:

  1. Load a helper in a specific function that needs it with
  2. Adding the helper to the autoload array

I mean: is there any system performance difference or is something else different, except for the usage?

Upvotes: 0

Views: 97

Answers (1)

DFriend
DFriend

Reputation: 8964

It's a question of need. Is the helper, library, model used by nearly every controller and/or method of every controller? Then autoload makes a lot of sense. Is it used in many methods of one (or two) controller? Then loading in the class constructor makes sense. Is the helper, library, model only used in one or two methods? Then loading it inside those methods makes the most sense.

Upvotes: 2

Related Questions