Forum Moderators: coopster
Heres what I want to change:
<link rel="stylesheet" type="text/css" href="<?=$location?>web.css" />
<?php include("<?=$location?>header.php");?>
<?php include("<?=$location?>footer.php");?>
Where $location equals something like "../../".
Obviously you can use PHP inside of PHP. Is there another way to do this?
You could set the variable at the top of your script. Or perhaps message #17 in this PHP Forum Library [webmasterworld.com] thread on Good PHP solutions to small problems [webmasterworld.com] will give you some ideas.
$location = "../../";
<?php include($location."header.php");?>
<?php include($location."footer.php");?>
See, that requires you to define $location on each page. I would store the value of $location in a database or text file. Then, you can query the db or read the text file to get the $location string. If you ever needed to change the value of $location, you'd only need to edit one database entry or text file.
If I were you, I'd place:
[yoursite...] (your ABSOLUTE url)
into a text file and read it with each page.
require_once($_SERVER 'DOCUMENT_ROOT']."/header.php");
where header is set relative to root
>>>
as such you may include the header wherever regardless
ot its full path
Coopster has a nice include set once for all in our library
I cannot remember where it is
but Coops if you read this...
thanks