Welcome Guest, Not a member yet? Register   Sign In
Creating variables of type (class)
#1

[eluser]Unknown[/eluser]
Hi, Ultra newb question,

I want to create a custom class that will be used in models, views and controllers. I will be creating instances of this class in many non member functions. Where do I define this class to be available everywhere?

Note: I am less interested in methods, however, I am dealing with complex data and need to use lots of properties. I want to create instances of this class in many non member functions.

Thanks for the help.
#2

[eluser]Aken[/eluser]
index.php
application/config/constants.php
application/config/config.php

Or create your own custom file and include it wherever appropriate. Lots of options, use what works best for you.
#3

[eluser]InsiteFX[/eluser]
I created a custom Property library and property_helper that gives access to your whole application.
Code:
// this is a private static array like below.
array ( $index => array ( $key => $val ));

If anyone is interested let me know and I will upload it to my server for download.
#4

[eluser]Unknown[/eluser]
Thanks!

I guess, when you are using a system like this, you can forget that you can continue to do things the old fashioned way.
#5

[eluser]mlakhara[/eluser]
@InsiteFX

Is this property helper an implementation of "The Registry Pattern" for global access?
If yes, then how is it available throughout the application? Do we have to pass the object as parameter or we use native SESSION variables to save this?

I will really appreciate if you upload the code of your property class and helper.
#6

[eluser]InsiteFX[/eluser]
It is based on the registry pattern but not a full Implementation of it, it is built so that it works with CodeIgniter. The main access point is through a api type CodeIgniter helper file that interfaces to the library.





Theme © iAndrew 2016 - Forum software by © MyBB