Posted by Ken LE PRADO on 07/18/05 20:57
Here is a part of my website :
-------- file included by every pages --------
$config['baseUrl'] = 'http//some.website.com/dir1';
function makeUrl ($relativePath = '') {
global $config;
//Vérifie si le client accepete les cookies
if (ereg("^/", $relativePath)) {
$base = $config['baseUrl'];
} else {
$base = $config['baseUrl'] . '/';
}
$url = $base . $relativePath;
return($url);
}
-------- some page --------
<?php
include('file_above.inc');
?>
<a href="<?=makeUrl('dir2/file3.php')?>">Your link</a>
--------------------------
This is simple way to make Absolute paths writing relatives ones
[Back to original message]
|