Welcome Guest, Not a member yet? Register   Sign In
Controller & access other class properties
#1

[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.
#2

[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-gui...onfig.html
#3

[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.
#4

[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.




Theme © iAndrew 2016 - Forum software by © MyBB