Forum Moderators: coopster
nimonogi - Try this:
$filename = 'file.php';
echo substr($filename, 0, strpos($filename, '.'));
Before we were using strrpos() which searched for the last dot, and stripped everything after it.
Now we are using strpos() which searches for the first dot and strips everything after it.
I face a problem with IE and the code noted below.
FireFox works just great but IE screw them up when using paths. ex. Instead of domain.com/path/file.php i get domain.com/path/ (domain.com/path/index.php)
'http://'.$_SERVER['HTTP_HOST'].substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], '.'));
Does anybody know how to fix this?
Thanks.
'http://'.$_SERVER['HTTP_HOST']. basename(substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], '.')));
This should work fine too, fi your files are always '.php' and not anything else:
'http://'.$_SERVER['HTTP_HOST']. basename($_SERVER['PHP_SELF'], '.php');
Look up basename() which will explain what is going on.
Does that do what you need?