Re: site path
| From: | Bogdan Stancescu | Date: | Thu, 10 Oct 2002 13:18:03 +0000 |
| Subject: | Re: site path | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-119524@lists.php.net to get a copy of this message | ||
I generally use both - the first for includes and the second for HTML links.
Do NOT include the trailing slash. The reason is simple:
<?
echo("<A HREF='$my_URL/home'>Go home</A>");
?>
is much simpler to write and follow than
<?
echo("<A HREF='{$my_URL}home'>Go home</A>");
?>
because you obviously can't write
<?
echo("<A HREF='$my_URLhome'>Go home</A>");
?>
Please remember that since the trailing slash will be included in every use of this var, if your URL is the root then the variable will have to be empty! (otherwise you'll end up with a double slash at the beginning of every URL)
Bogdan
Wilmar Perez wrote:
Hello guys
I'm just looking for some advise: I've got a variable which I use to store my site's main path. Is it better to have it like this:
$site_path = "/my/web/path/"
or like this:
$site_path = "http://my_url.com/"
?
What about the trailing slash?, should I use it or not?
I know these are simple question but haven't been able to get to an answer on my own.
Thanks a lot
*******************************************************
Wilmar Pérez
Network Administrator
Library System
Tel: ++57(4)2105145
University of Antioquia
Medellín - Colombia
2002 *******************************************************