SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: DIE, include(), DIE!
-
Mar 31, 2001, 06:58 #1
- Join Date
- Sep 2000
- Location
- Halmstad, Sweden
- Posts
- 7,400
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
Okay, this problem is stupid, stupid, and dumb, but I just can't figure it out.
index.php:
Code:$x = "some string"; $y = "another some string"; $z = "a third some string"; include ("header.php");
Code:<HTML> and other stuff <? echo "$x, $y, $z ?>
Mattias Johansson
Short, Swedish, Web Developer
Buttons and Dog Tags with your custom design:
FatStatement.com
-
Mar 31, 2001, 07:25 #2
- Join Date
- Jun 2000
- Location
- Sydney, Australia
- Posts
- 3,798
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Well I'm pretty new to web programming with PHP - but that's not the way I would do it. I'm not saying its wrong - just that my mind would tackle it differently.
I would probably write a function
Code:function print_header($x, $y, $z) { // do stuff echo $x $y $z; }
But anyway, just guessing here but maybe in your file header.php use this:
Code:<html stuff> <? global $x, $y, $z; echo "$x, $y, $z ?>
-
Mar 31, 2001, 07:57 #3
- Join Date
- Sep 2000
- Location
- Halmstad, Sweden
- Posts
- 7,400
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
The global() thingy solved it, thanks! Never seen that before - need to look it up later.
heh - I'd better learn PHP from scratch instead of this hard way.Mattias Johansson
Short, Swedish, Web Developer
Buttons and Dog Tags with your custom design:
FatStatement.com
-
Mar 31, 2001, 08:03 #4
- Join Date
- Jun 2000
- Location
- Sydney, Australia
- Posts
- 3,798
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Nah - the hard way is more satisfying
Bookmarks