Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
using self created classes
  • Hi i am having some problems regarding the files created.I am have written a simple script for bargraph which is needed for me.where to keep the library like function (packages or somewhere else). I was thinking to keep it in models directory but i was thiking to keep the files in model having the database transactions only.Please give me some idea.Before fuel i was using codeigniter . i used to keep those files in library. If i used the packages directory then should i create config and bootstap file too? any help will be appreciated
  • Check http://fuelphp.com/docs/general/classes.html Thus if your class is called "Bargraph" it should be in app/classes/bargraph.php
    If you put it in the models dir, the name should reflect that as well: classname "Model_Bargraph" and location would be app/classes/model/bargraph.php. Underscores = directory separators
    Classname = path after app/classes
    Path = "app/classes" + str_replace('_', '/', strtolower(Classname)) + ".php"
  • Thank you. It worked. But i have a question regaurding it.
    Can i load this class in only the controller that i need or it is loaded all the time even if it is unwanted.?
  • Fuel uses PHP autoloading, which means any class is only loaded when used. Otherwise it's not.
  • Thank You .Jelmer

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion