Gossamer Forum
Skip to Content



Home : Gossamer Threads Inc. : Discussion :

GT::CGI::redirect from within a template

Quote Reply
GT::CGI::redirect from within a template
Is it possible to call <%GT::CGI::redirect($someurl)%> from within a template? I'm having trouble getting that to work... Is it because it's too late to send HTTP headers at the top of a template file? Any suggestions would be appreciated.

Thanks.

Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund
Quote Reply
Re: [hennagaijin] GT::CGI::redirect from within a template In reply to
Hi,

I would think so. The template parser is called after a print $IN->header or is out put after one.

In order to redirect, you'd need to make a script that handles that case, and doesn't print out those headers. Not sure which program you are using this in, so I can't give you any clues.

But if you know the script that is printing out your request, you can edit that script to not send standard headers. _Old_ versions of jump.cgi in Links used to show this pretty well.


PUGDOGŪ Enterprises, Inc.

The best way to contact me is to NOT use Email.
Leave a PM here, or better yet, in the
Ultranerds.com: http://ultranerds.com/forum

Rock & Bead Shop: http://BetterBeads.com
Need a good Identity? http://IdentityDots.com
Quote Reply
Re: [pugdog] GT::CGI::redirect from within a template In reply to
Thanks, pugdog. Actually it's DbMan SQL, so there's the one db.cgi script that handles the entire front end of things. I'll do a little poking around to see where it prints headers and maybe hack something there.

Is my syntax basically correct for using GT::CGI? Would that work if called prior to any HTTP headers being printed?

Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund
Quote Reply
Re: [hennagaijin] GT::CGI::redirect from within a template In reply to
Quote:
Is my syntax basically correct for using GT::CGI? Would that work if called prior to any HTTP headers being printed?

It should work in LinksSQL (format wise), so I would say yes.

Cheers

Andy (mod)
andy@ultranerds.com



Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [hennagaijin] GT::CGI::redirect from within a template In reply to
Hi,

Like andy said, it should work, if you can "kill" the extra print headers command. Might take some trial and error to make work, or it might not work.

I don't have a copy of dbman to even suggest where/what to do.


PUGDOGŪ Enterprises, Inc.

The best way to contact me is to NOT use Email.
Leave a PM here, or better yet, in the
Ultranerds.com: http://ultranerds.com/forum

Rock & Bead Shop: http://BetterBeads.com
Need a good Identity? http://IdentityDots.com
Quote Reply
Re: [hennagaijin] GT::CGI::redirect from within a template In reply to
Hi hennagaijin,

why not just use meta tags:

meta http-equiv="refresh" content="0; URL=/cgi-bin/script.cgi"

Regards

Niko
Quote Reply
Re: [el noe] GT::CGI::redirect from within a template In reply to
Yes, meta redirect tags are an option. The problem is that they're not as secure or reliable as doing the redirect server-side. But I suppose it's fine as a backup plan.

Thanks to all for the advice.

Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund
Quote Reply
Re: [hennagaijin] GT::CGI::redirect from within a template In reply to
Quote:
Is it possible to call <%GT::CGI::redirect($someurl)%> from within a template? I'm having trouble getting that to work... Is it because it's too late to send HTTP headers at the top of a template file? Any suggestions would be appreciated.

Yes, it's too late to send headers by the time the template is parsed/printed. You need to send them before the template is done. You can just do:

print $IN->redirect("some url");

Cheers,

Alex
--
Gossamer Threads Inc.