I'm not sure whether you're confused about the terms you're using.
A CGI header isn't really something that exists .. there's an HTTP header which icnludes things like information about the cookie updates, and there's also whatever appears at the top of the web page, sy, a menu or something like that.
If you're talking about the first kind, then your CGI should be able to control what HTTP headers go out -- usually you're using the venerable CGI or something more advanced like CGI::Application so that you don't have to get your hands dirty actually sending out those kinds of headers yourself.
If you're talking about some kind of menu at the top of your page, then a templaet is probably what you're looking for .. I can highly recommend Template::Toolkit (and for the dyslexics in the audience, that's not Toolkit::Template) (see also the web site).
Think about those two options and see if you can give us more information on what you're looknig for. it's difficult to answer correctly if the question is not clear.
Alex / talexb / Toronto
"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds
| [reply] |
I might be misunderstanding the question, but I believe I did something similar to what you might need a long time ago. I put all of my header code in to a separate file and called it when needed throughout my CGI.(multiple pages, forms, error pages, confirmation page ...) it acted more like a bread crumbing, but maybe this is what you are looking for? I second the use of Template::Toolkit, but this was writen before I was comforatble with it, and can an alernative if you are limited to what you can use.
My 'header' displayHeader.pl:
sub displayHeader{
print <<DISPLAYINGHEADER;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- continue all of the junk you want to include in each page -->
DISPLAYINGHEADER
}
From there, my CGI required the displayHeader file and called it like so:
sub displayErrorPage{
&displayHeader;
...
}
sub displayConfirmationPage{
&displayHeader;
print $cgi->p("Thank You");
...
}
The two functions above are entered based on the return value of a form validation subroutine (error checking form input).
| [reply] [d/l] [select] |
You can't via CGI. Your best bet is to configure the webserver to always run some script before every other script, or something similar. For example, using apache and mod_perl, it is possible to configure a script that runs after every request and gets the full content that would be sent back to the request. | [reply] |