If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / I want to define myself grobal var,where to put it?

I want to define myself grobal var,where to put it?

Started by linjuming on 7 Jul 2012, 7:41 AM · Views: 430

Results 1 to 2 of 2
7 Jul 2012, 7:41 AM
#1
linjuming avatar

linjuming

Zen Follower

Join Date:
Apr 2012
Posts:
151
Plugin Contributions:
0

I want to define myself grobal var,where to put it?

for example, I want to create a grobal var $coupon_amount ,this var can be used for any page of systerm.
where to place my var?

7 Jul 2012, 1:52 PM
#2
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: I want to define myself grobal var,where to put it?

If you are talking about a php variable then you would create a session variable. You just need to check that that session variable is not used yet and I am not sure about 'coupon_amount' so I would use something more unique than that. You'd do it like this:

$myVariable = $_SESSION['my_variable'];

And you would want to consider unsetting it when you have finished using it.

Nick
iszent.com