Gossamer Forum
Home : General : Perl Programming :

cgi.pm and javascripts

Quote Reply
cgi.pm and javascripts
I am trying to avoid using frames, but would also like to avoid changing the code on all of my pages when I add or subtract something from my menu bar. For my menu bar, I use Adobe Image Ready to slice and dice an image file, give it mouse over properties, and generate the html and java to give it functionality. Unless I am missing an easy solution, I envision calling on menu.cgi - via ssi - in all my pages. This way, I only update the code in menu.cgi when I have a menu change - rather than editing each individual page. Is there a simple way to do this with cgi? I tried several options to no avail.

although logical, I do not think you can simply use a print statement and "s with all of the code in between.

print " <all your code>";

but from an ease of use point of view - this method would be worse than changing the individual pages:

print "<html>\n";
print "<body>\n";
etc. for every line of code...

I saw this and was excited as an option, but no luck here either:

print <<EOL;
<all your code>
EOL

but no matter what I try, I get an error. I know that cgi.pm plays a big part in the execution, but I 1) don't know how to code it and 2) know where the bulk of the html needs to go.

can I make a variable called $body with all of the code

and then

print <$body>;



any pointers or recomendations are greatly appreciated!

Last edited by:

shiner: Jun 13, 2002, 10:02 AM
Quote Reply
Re: [shiner] cgi.pm and javascripts In reply to
print <<'CODE';

Some html

CODE

...should work fine. If you get an error like can't find string terminator CODE at end of EOF (or whatever it is) then it means you have a space infront of the closing tag.....eg....

Code:
print <<'CODE';

Foo

CODE

....will work.

Code:
print <<'CODE';

Foo

CODE

....won't

Last edited by:

Paul: Jun 13, 2002, 9:47 AM
Quote Reply
Re: [Paul] cgi.pm and javascripts In reply to
Paul,

Thank you for the quick reply! I have attached the new menu.cgi - but I am getting the ever popular RAQ4 error of

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.


and not shure where I am going wrong. The calls in the html are physical paths and not relative - so it you wanted to try it, it should open the correct files.
Quote Reply
Re: [shiner] cgi.pm and javascripts In reply to
got it!

was missing this:

print "Content-type: text/html \n\n";