
jeffrey Afable - 2012-01-01 13:03:40 -
In reply to message 1 from rudie dirkx
You can add a function like this.
Example:
<a href="<?php echo PathUrl('Link1'); ?>">Link1</a>
function PathUrl($path="",$viewIndex=TRUE){
$index = ($viewIndex==TRUE)?'/index.php':'';
$SCRIPT_NAME = $_SERVER['SCRIPT_NAME'];
if(strpos($SCRIPT_NAME,'index.php')>1 && !preg_match("/\/index.php/i",$_SERVER['REQUEST_URI'])) header('Location: '.$SCRIPT_NAME);
$SCRIPT_NAME = substr($SCRIPT_NAME,0,strpos($SCRIPT_NAME,'index.php'));
$isindex = preg_match("/index.php/i",$_SERVER['REQUEST_URI']);
if($isindex!=FALSE)
return str_replace('//','/',$SCRIPT_NAME.$index.'/'.$path);
else
return str_replace('//','/',$SCRIPT_NAME.'/'.$path);
}
I use this in one of my framework i made :) work fine..