Re: Re: site path
| From: | Bogdan Stancescu | Date: | Fri, 11 Oct 2002 07:10:16 +0000 |
| Subject: | Re: Re: site path | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-119611@lists.php.net to get a copy of this message | ||
If you really need to get picky, then I shall... well, point out the obvious:
echo "<a href='$theURL/'>Go to some folder</a>";
And since we got into this, there are some servers where you don't have control over http config, so you shouldn't want to link to directories at all - you'd want to specify the exact file to link to, as in
echo "<a href='$theURL/index.php'>Go to some folder</a>";
Bogdan
@ Edwin wrote:
Well, I agree about what you saidIMHO, the second comes more natural to write, is easier to understand at a glance, is less prone to errors and, well, it's shorter!but remember the topic is about whether the trailing slash would create a problem or not. I think you're aware that there are some servers are not configured to understand that http://www.domain.com/somefolder is equal to http://www.domain.com/somefolder/ . So, NOT having the trailing slash might even create some problems. So, it's a matter of opinion (and use) whether adding a trailing slash would create a problem or not. So imagine how this code will work: echo "<a href='$theURL'>Go to some folder</a>"; - E On Friday, October 11, 2002 2:28 PM Bogdan Stancescu wrote:Ok, then I honestly don't understand why anyone would rather write this echo "<a href='" . $myURL . "home'>Go home</a>"; instead of this echo "<a href='$myURL/home'>Go home</a>"; IMHO, the second comes more natural to write, is easier to understand at a glance, is less prone to errors and, well, it's shorter! Bogdan @ Edwin wrote:words,Not exactly. Single quotes are fine. I missed the fact that the single quotes herewill be included in the source--sorry about that. Well, then, to rewrite the code earlier,echo("<A HREF='$my_URLhome'>Go home</A>");echo '<a href="' . $my_URL . 'home">Go home</a>';this way: echo "<a href='" . $myURL . "home'>Go home</a>"; that would still not give you the "trailing slash" problem. In otherit's just a matter of how you write the code... ;) - E On Friday, October 11, 2002 1:06 AM Bogdan Stancescu wrote:-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpI'm not sure exactly what you're trying to point out - does XHTML require double quotes? Bogdan @ Edwin wrote:haveJust a thought... If you're going to write an XHTML compatible code, you wouldn't really[snip]this problem -->echo("<A HREF='$my_URLhome'>Go home</A>");since you'll probably write something like this: echo '<a href="' . $my_URL . 'home">Go home</a>'; > Of course, I didn't mean that you can't do that with HTML...