PDA

View Full Version : parsing INCLUDE from inside CGI?


wfcentral
06-02-2003, 05:20 PM
I have a CGI program that maintains my library of links (business, clubs, dining) on my community website. The script (not mine) allows me to place a custom title / body / in a cfg file that will pull it into every page the script generates.

The original author offers this script for free / as is / no support...
I would like to include a header that I use throughout my site on these pages. I pull it into all other pages using a virtual include.

If I put a virtual include into the cfg file for this script it does not parse it, it just returns the include statement (no header) - so, how do you use an include inside a cgi page??

ACJavascript
06-02-2003, 05:32 PM
If you can put in a title and body in the cfg page why not just put the actual head code in.

wfcentral
06-02-2003, 05:44 PM
The head code is html and javascript. The cfg file is setup so that it knows what is on each line...

1. name of category
2. body tag
3. your stuff
4. category

So, all my stuff has to go on line 3. I tried condensing the header javascript to one line but that won't work...

Robert

ACJavascript
06-02-2003, 05:57 PM
mmm,, interesting hehe

How do you write the include?

----
other option. Mabye you should try to call it using javascript.

wfcentral
06-02-2003, 06:03 PM
Here is what the part inside the CGI looks like...

sub header
{
print "<html>\n<head><title>$headTitle</title><link rel=stylesheet href=http://www.wfcentral.com/styles/wfc.css type=text/css></head>\n";
print "$bodyTag\n$bodyTitle\n<br>\n";
}


is it possible to insert the following code inside the sub header so that I get my custom javascript dropdown menu on every page?

<SCRIPT language=JavaScript>
/*
Milonic DHTML Website Navigation Menu.
Written by Andy Woolley - Copyright 2003 (c) Milonic Solutions Limited. All Rights Reserved.
Please visit http://www.milonic.co.uk/ for more information.
*/
</SCRIPT>
<SCRIPT language=JavaScript src="http://www.wfcentral.com/menu/menu_array.js" type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript src="http://www.wfcentral.com/menu/mmenu.js" type=text/javascript></SCRIPT>

<table bgcolor="red" width="100%" cellpadding=0 cellspacing=0><tr><td>
<img src="http://www.wfcentral.com/images2003/hdr_spacer.gif" width="468" height="105" alt="468-105" border="0">
</td>
</tr>
</table>

wfcentral
06-02-2003, 06:05 PM
It would be even better if I could insert my SSI call

<!--#include virtual="/includes/header.inc" -->

into the cgi at the sub header location...

sub header
{
print "<html>\n<head><title>$headTitle</title><link rel=stylesheet href=http://www.wfcentral.com/styles/wfc.css type=text/css></head>\n";
print "$bodyTag\n$bodyTitle\n<br>\n";
}

ACJavascript
06-02-2003, 06:26 PM
Try this

--

sub header {

print <<EOF;
<html>
<head><title>$headTitle</title>
<link rel=stylesheet href=http://www.wfcentral.com/styles/wfc.css type=text/css>
</head>
$bodyTag
$bodyTitle
<br>
<SCRIPT language=JavaScript>
/*
Milonic DHTML Website Navigation Menu.
Written by Andy Woolley - Copyright 2003 (c) Milonic Solutions Limited. All Rights Reserved.
Please visit http://www.milonic.co.uk/ for more information.
*/
</SCRIPT>
<SCRIPT language=JavaScript src="http://www.wfcentral.com/menu/menu_array.js" type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript src="http://www.wfcentral.com/menu/mmenu.js" type=text/javascript></SCRIPT>

<table bgcolor="red" width="100%" cellpadding=0 cellspacing=0><tr><td>
<img src="http://www.wfcentral.com/images2003/hdr_spacer.gif" width="468" height="105" alt="468-105" border="0">
</td>
</tr>
</table>
EOF
}