CodeIgniter Forums
access variable and function from a file throughout the CI project - 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: access variable and function from a file throughout the CI project (/showthread.php?tid=22199)



access variable and function from a file throughout the CI project - El Forum - 09-01-2009

[eluser]ranjitbd[/eluser]
Code:
//i have a file name: needed_variable.php where i set all necessary array variable like //month name, day name etc frequently i needed.

//and i have another file name php_function.php where i have all necessary customise
//php function.

//i want to use those variable and function from any where every now and then.

//so in which folder i have to paste this two files and how to load these files as auto load //library. and how to access those variable and function in different method in the //controller

// please help me  with an example



access variable and function from a file throughout the CI project - El Forum - 09-01-2009

[eluser]jedd[/eluser]
You're very funny.

Try extending the base controller, and putting your arrays and function(s) into there.

This is described in [url="http://ellislab.com/codeigniter/user-guide/general/core_classes.html"]the CI User Guide[/url]

I see that [url="http://ellislab.com/forums/viewthread/127479/"]pistolPete also answered much the same question from you three days ago[/url].