CodeIgniter Forums
Controller & access other class properties - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Controller & access other class properties (/showthread.php?tid=12511)



Controller & access other class properties - El Forum - 10-22-2008

[eluser]Joseph1982[/eluser]
Hi,

This is a basic question about the OOP & CI.

I have a settings.php & another page (for doing the CURL operations). How can I access the values from settings.php in the Controller function?

Is it need to convert this settings.php page to a class to access it inside the Controller function?


And the operations inside the Controller function is based on the Curl class (curl.php). How can I call this class functionsfrom the Controller function ?

Please guide me..

Thank You,
Joseph An.


Controller & access other class properties - El Forum - 10-22-2008

[eluser]JoostV[/eluser]
You can use your settings.php as a custom config file. Place it in applications/config and call it in your controller using
Code:
$this->config->load('settings');

As for how to set up a custom config file, read the user guide: http://ellislab.com/codeigniter/user-guide/libraries/config.html


Controller & access other class properties - El Forum - 10-22-2008

[eluser]Joseph1982[/eluser]
Thank you for your reply and the URL for getting more information about the topic.

Can I know, how can I include the external class file (for doing some operations) into my controller function ? Is it need to load the class file into the library ?

Thank You,
Joseph.


Controller & access other class properties - El Forum - 10-22-2008

[eluser]JoostV[/eluser]
A config file is not a class file. It is used for settings only. If you need functions you can call, place them in a model or library and load that into your controller.