Other PHP question... - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Skype & Technology (/forumdisplay.php?fid=9) +---- Forum: Tech Talk (/forumdisplay.php?fid=17) +----- Thread: Other PHP question... (/showthread.php?tid=27454) Other PHP question... by leito on 06-20-2004 at 11:07 PM
Hi all, working on a PHP file, I include a file, which has a link, let's say: RE: Other PHP question... by WDZ on 06-21-2004 at 04:11 AM
I think the simplest thing to do is put a slash (and a path, if necessary) before the file name (index.php). For example, this file has a link to "/index.php" and it will link to http://shoutbox.menthix.net/index.php no matter what folder it's in... quote:You should try this instead: dirname($_SERVER['PHP_SELF']) If you're running the script http://site.com/files/images/index.php, that code will return "/files/images" RE: Other PHP question... by leito on 06-21-2004 at 04:45 AM
quote: Thnx, I think I could ask if (directory is this) link=index.php else link=../index.php .... RE: Other PHP question... by KeyStorm on 06-21-2004 at 01:51 PM
Well, you can also use: 'http://'.$_SERVER['SERVER_NAME].$_SERVER['PHP_SELF'] to get the current path to the current script. |