homepage Welcome to WebmasterWorld Guest from 54.197.94.241
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Variables
Few questions
Echo_Tyme




msg:1270222
 10:31 pm on Aug 11, 2004 (gmt 0)

How do you call a variable from a page?

I have index.php contain variables, then this loads up a template page that calls the variables... now how do you have a page like header.php then have a variable from that page get called?

Also every page is different in that some pages have 5 tables, some have 3. how could I code this to work out? I have a template and need it to call a variable that can contain the code, but how would it know to add another line?

 

ergophobe




msg:1270223
 2:39 pm on Aug 12, 2004 (gmt 0)

It's all about scope [us3.php.net], not just a mouthwash any more.

Basically, any variable that is defined in the main file or a file that was folded into the main file with include() or require() will be available downstream (i.e. after the point it was included).

Within functions, the scope is local, meaning the variable is only available within the function. Typically, to get a single value out of a function, you use the 'return' statement to return a value.

If you can read through the manual and maybe find some other pages (search on "variables scope php") to help you get the basics down, a lot of other threads on templates will become much, much clearer to you.

Tom

Echo_Tyme




msg:1270224
 10:08 pm on Aug 12, 2004 (gmt 0)

Bah I hate those damn things. if a=1 and b=0, grrrrr i searched it but it didn't seem to have anything I needed.

If what you say is true then if I have a page get called up then i can call it up, how i dunno b/c that article is freaking confusing.

Echo_Tyme




msg:1270225
 11:56 pm on Aug 12, 2004 (gmt 0)

I tested "scope" and that worked quite nicely. I called it up in my index page, the index page then asked for that variable and that it called it up automatically ^.^

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved