Link to Mod Share Mod Share

  Users Browse Upload Forums Log in

Mod Share Forums

Welcome to the Mod Share forums.

You are not logged in.

#1 2012-05-24 10:45:38

stevetheipad
Retired Community Moderator
Registered: 2012-03-22
Posts: 82

Global variables

Does anyone know how to declare a variable global so I can echo it in a different .php file?
And do I have to declare it global in the echo, too?


stevesnewsignature.jpg                     
Stevetheipad - SDS Curator, Programmer and Designer

Offline

#2 2012-05-24 10:54:44

jacob
Mod Share Team (now jvvg)
From: Eastern United States
Registered: 2011-12-25
Posts: 375
Website

Re: Global variables

If you are including the file, it is already there.

Otherwise, you need to write it to a file or database.


zwgbewe1gbewzygbewizgbew
Fear me, all powerful forum moderator! tongue

Offline

#3 2012-05-24 10:55:38

stevetheipad
Retired Community Moderator
Registered: 2012-03-22
Posts: 82

Re: Global variables

jacob wrote:

If you are including the file, it is already there.

Otherwise, you need to write it to a file or database.

?


stevesnewsignature.jpg                     
Stevetheipad - SDS Curator, Programmer and Designer

Offline

#4 2012-05-24 11:02:51

jacob
Mod Share Team (now jvvg)
From: Eastern United States
Registered: 2011-12-25
Posts: 375
Website

Re: Global variables

stevetheipad wrote:
jacob wrote:

If you are including the file, it is already there.

Otherwise, you need to write it to a file or database.

?

Your question is a bit unclear.

Are you saying there are two separate scripts that are run independently of each other, or are you including one within the other?


zwgbewe1gbewzygbewizgbew
Fear me, all powerful forum moderator! tongue

Offline

#5 2012-05-24 20:18:59

SJRCS_011
Community Moderator
From: Northeastern United States
Registered: 2012-01-15
Posts: 143
Website

Re: Global variables

jacob wrote:
stevetheipad wrote:
jacob wrote:

If you are including the file, it is already there.

Otherwise, you need to write it to a file or database.

?

Your question is a bit unclear.

Are you saying there are two separate scripts that are run independently of each other, or are you including one within the other?

you could also use Session variables

Last edited by SJRCS_011 (2012-05-24 20:19:16)


Mod Share- with Collab Features!
vQqtH.png
Learning Programming in a Nutshell: "You're missing a closing parenthesis" - LS97

Offline

#6 2012-05-24 20:22:13

jacob
Mod Share Team (now jvvg)
From: Eastern United States
Registered: 2011-12-25
Posts: 375
Website

Re: Global variables

SJRCS_011 wrote:
jacob wrote:
stevetheipad wrote:
jacob wrote:

If you are including the file, it is already there.

Otherwise, you need to write it to a file or database.

?

Your question is a bit unclear.

Are you saying there are two separate scripts that are run independently of each other, or are you including one within the other?

you could also use Session variables

I talked to him over Google Chat, and he said he means between all scripts.
This requires storing them externally (in a file, cookie, database, etc.), and I gave him a quick and dirty tutorial on it.


zwgbewe1gbewzygbewizgbew
Fear me, all powerful forum moderator! tongue

Offline

#7 2012-05-24 20:23:09

SJRCS_011
Community Moderator
From: Northeastern United States
Registered: 2012-01-15
Posts: 143
Website

Re: Global variables

jacob wrote:
SJRCS_011 wrote:
jacob wrote:
stevetheipad wrote:

?

Your question is a bit unclear.

Are you saying there are two separate scripts that are run independently of each other, or are you including one within the other?

you could also use Session variables

I talked to him over Google Chat, and he said he means between all scripts.
This requires storing them externally (in a file, cookie, database, etc.), and I gave him a quick and dirty tutorial on it.

you can use it across all scripts, it's just not permanent


Mod Share- with Collab Features!
vQqtH.png
Learning Programming in a Nutshell: "You're missing a closing parenthesis" - LS97

Offline

#8 2012-05-24 20:30:19

jacob
Mod Share Team (now jvvg)
From: Eastern United States
Registered: 2011-12-25
Posts: 375
Website

Re: Global variables

SJRCS_011 wrote:
jacob wrote:
SJRCS_011 wrote:
jacob wrote:

Your question is a bit unclear.

Are you saying there are two separate scripts that are run independently of each other, or are you including one within the other?

you could also use Session variables

I talked to him over Google Chat, and he said he means between all scripts.
This requires storing them externally (in a file, cookie, database, etc.), and I gave him a quick and dirty tutorial on it.

you can use it across all scripts, it's just not permanent

I haven't heard of session variables. I'm going to look it up on php.net now. *looks it up* Cool, that could be useful in the future.


zwgbewe1gbewzygbewizgbew
Fear me, all powerful forum moderator! tongue

Offline

Board footer

This is part of Mod Share v4.0