Welcome Guest, Not a member yet? Register   Sign In
Global variables, set defined variables
#1

[eluser]bigdaddysheikh[/eluser]
Hey guys,

I have been searching for this topic for quiete sometime and have not found what I am looking for. So here it goes.

I keep having undefined errors from CI. Although it is not PHP errors, I know it is bad practice. First, is there a way to define these variables in the controller so it can be sent through different functions.

Currently, I am trying to use a variable that will hold URLS that I want to display in many sub functions of the mother controller. Rather than me declaring this variable in every function, how can I set this variable only once.

Last but not least, is there a better way to pass arrays to views.
example
Code:
$data["foo"][0] = "test";
$data["foo"][1] = "test1";

I did try this, but it does not work:
Code:
$data["foo"] = "test";
$data["foo"] = "test1";


Messages In This Thread
Global variables, set defined variables - by El Forum - 07-15-2008, 01:01 PM
Global variables, set defined variables - by El Forum - 07-15-2008, 02:37 PM



Theme © iAndrew 2016 - Forum software by © MyBB