[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [StrongED] Re: sending PHP file to browser
On 15/08/2018 23:35, Tim Hill wrote:
In article <98b8c20d-b256-c5bc-c68b-1bf0efc58832@xxxxxxxxxxxxxxxxxx>,
Vince M Hudd <atdotcodotuk@xxxxxxxxxxxxxxxxxx> wrote:
[...]
Doesn't that cause problems with internal links?
No, as I always use relative links or sometimes the PHP works out where
it is running and sets a base path accordingly. Here's one example of the
latter.
<?php
$dirname = dirname(__FILE__);
if ( substr($dirname,1,7) == "freeola" ) {
$base = "http://youngtheatre.co.uk/archive/";
} else {
$base ="http://dev.timil.com/yt.co.uk/archive/";
}
print("<base href=\"$base\" target=\"_top\">\n");
?>
That's an ugly hack to get around the fact that you haven't set your web
server up correctly. :p
[...]
For example, on my sites (those for which I don't use a CMS) I tend to
put the CSS file(s) in a top level directory called skin. I link to
them from every page as /skin/file.css - but if I did something like
the above for the local copy, it would be looking in Web_Sites.skin
instead of Web_Sites.softrock.skin
"/" is not a relative file reference! Bad boy! ;-)
Making links relative to the file that contains them can be messy.
Starting a link with a / makes it relative to the top level of the site,
and is a perfectly good - and indeed sensible - way to reach resources
found in a fixed location within the site.
--
Vince M Hudd
Soft Rock Software - www.softrock.co.uk
RISCOSitory - www.riscository.com
--
To unsubscribe send a mail to StrongED+unsubscribe@xxxxxxxxxxx
List archives and instructions at
http://stronged.torrens.org/index.html