Re: Current URL
| From: | Robert Cummings | Date: | Fri, 04 Jun 2004 05:59:27 +0000 |
| Subject: | Re: Current URL | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-187595@lists.php.net to get a copy of this message | ||
On Fri, 2004-06-04 at 01:38, Aidan Lister wrote:
> Hi,
>
> You could use $_SERVER['DOCUMENT_ROOT']
>
That doesn't work... as the OP mentioned, the URLs might need to refer
locally within a subsite built as a subdirectory within the document
root.
Cheers,
Rob.
>
> "Robert Cummings" <robert@interjinn.com> wrote in message
> news:1086319737.29789.8.camel@blobule.suds...
> > On Thu, 2004-06-03 at 23:15, Stephen Craton wrote:
> > > I've wondered for quite some time, and search just as long it seems
> like,
> > > for a way to get the current URL directory. For example, let's say you
> were
> > > at www.example.com/files. The script is executing in this directory, and
> > > it's calling an include script from the base (www.example.com or maybe
> even
> > > www.example.com/includes). In this included file are some links and
> maybe
> > > some images. These images and links are set up to be called from the
> base
> > > directory, so basically all the links inside the file say something like
> > > "images/bob.gif" or something of that nature.
> > >
> > > How could you dynamicaly change this in relation to where the included
> > > script is? If I were to include it in that files in /files, it would
> look
> > > for the images in /files/images/bob.gif which would not be there. One
> > > solution I have thought of is just putting the / at the beginning
> (/images/)
> > > but that wouldn't be the safest solution if the script were running in a
> > > subfolder to begind with (like the entire site is in
> www.example.com/site1).
> > >
> > > I hope you understand what I'm trying to say. Any ideas?
> >
> > In a configuration file shared by the project's scripts have a constant
> > or global variable like follows:
> >
> > $GLOBALS['imageBase'] = '/site1/';
> >
> > Now wherever in your site you use an image you can use this value to
> > prepend the image path.
> >
> > Cheers,
> > Blobbie.
> > --
> > .------------------------------------------------------------.
> > | InterJinn Application Framework -
> > http://www.interjinn.com |
> > :------------------------------------------------------------:
> > | An application and templating framework for PHP. Boasting |
> > | a powerful, scalable system for accessing system services |
> > | such as forms, properties, sessions, and caches. InterJinn |
> > | also provides an extremely flexible architecture for |
> > | creating re-usable components quickly and easily. |
> > `------------------------------------------------------------'
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'