View / Download this file.
---------------
$_BASE VARIABLE
---------------
-----------
DESCRIPTION
-----------
The $_BASE variable stores the URL (slash terminated) to the requested PTM
script, not including the PTM script's file name. Meaning that if the
requested script was "http://www.mysite.com/index.ptm", $_BASE would contain
"http://www.mysite.com/". This variable was created to be used primarily in
HTML "base" tags, for when the developer has decided to use .htaccess
virtual redirection to make URLs look nice.
Example:
"http://www.mysite.com/10/"
- Redirected To -
"http://www.mysite.com/index.ptm?page=10"
When redirections like this occur, the use of a "base" tag is necessary to
let the browser know "./images/" refers to "http://www.mysite.com/images/"
and not "http://www.mysite.com/10/images/". In the given example, $_BASE
would hold "http://www.mysite.com/", without the "10/", because the PTM
script file actually exists in the root web accessible directory and not in
a "10" subdirectory. $_BASE always stores the URL path to the script AFTER
any URL redirection has occured.
The $_BASE variable is also useful as it gives you a constant URL path to
your script, even if redirection has occured, so you always know where you
are.
--------------
USAGE EXAMPLES
--------------
-----------------------------------------------------------------
Example 1: Setting Your HTML Base Directory Using the DISPLAY Tag
-----------------------------------------------------------------
<head>
<base href="<?= $_BASE ?>">
</head>
----------------------------------------------------------------------------
Example 2: Showing the Script's Actual URL with the DISPLAY Tag and $_SCRIPT
----------------------------------------------------------------------------
This script is located at <?= "$_BASE$_SCRIPT" ?>
--------
SEE ALSO
--------
TAGS
DISPLAY
VARIABLES
$_DOCUMENT_ROOT, $_PATH. %_SERVER, $_SCRIPT, $_URL
|