Gossamer Forum
Home : Products : DBMan SQL : Development, Plugins and Globals :

return full url using GT::CGI

Quote Reply
return full url using GT::CGI
I'm trying to write a simple global that returns the full url of the current page.

Here's what I've got so far:

sub {
# Retrieves the current page's url.
use GT::CGI;
my $in = new GT::CGI;
my $url = ($in->url);
return $url;
}

That works fine to retrieve the script name and query string, but I'm looking for the full, or at least relative, url. According to the docs:

Quote:
url - Retrieve the current URL.
Returns the current URL of the script. It defaults to display just the script name and query string.

Options include:

absolute => 1
Return the full URL: http://domain/path/to/script.cgi

relative => 1
Return only the script name: script.cgi

query_string => 1
Return the query string as well: script.cgi?a=b

path_info => 1
Returns the path info as well: script.cgi/foobar

remove_empty => 0
Removes empty query= from the query string

I'm not clear on how to use those options, though.

Thanks in advance for any advice.

Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund
Subject Author Views Date
Thread return full url using GT::CGI hennagaijin 2671 Oct 21, 2002, 1:20 PM
Thread Re: [hennagaijin] return full url using GT::CGI
604 2611 Oct 21, 2002, 1:39 PM
Post Re: [TheStone] return full url using GT::CGI
hennagaijin 2621 Oct 21, 2002, 1:42 PM