Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Add header/footer to CGI file?

Quote Reply
Add header/footer to CGI file?
I am trying to add a header to add.html (for instance) so that it gets included as part of the "Add a Site" page.

I started by adding this to site_html_templates.pl:

========================================
%globals = ( [omitted standard stuff]

site_title => $build_site_title,
css => $build_css_url,
banner => '',
site_header => &site_header,
site_footer => &site_footer,
generic_header => &generic_header,
generic_footer => &generic_footer
);

sub site_header {
# --------------------------------------------------------
# This is the header file to insert into your LINKS pages.

open (INC, "header/header.txt") or return "Can't find include file: header.txt"; return join ("",<INC> );
}

sub site_footer {
# --------------------------------------------------------
# This is the header file to insert into your LINKS pages.

open (INC, "footer/footer.txt") or return "Can't find include file: footer.txt"; return join ("",<INC> );
}
sub generic_header {
# --------------------------------------------------------
# This is the generic header file to insert into your LINKS pages.

open (INC, "header/gen_hdr.txt") or return "Can't find include file: gen_hdr.txt"; return join ("",<INC> );
}

sub generic_footer {
# --------------------------------------------------------
# This is the generic header file to insert into your LINKS pages.

open (INC, "footer/gen_ftr.txt") or return "Can't find include file: gen_ftr.txt"; return join ("",<INC> );
}
========================================

Then I put <%generic_header%> & <%generic_footer%> in add.html in cgi-bin/links/admin/templates.

The site_header & site_footer sections work just fine. The problem lies in the generic sections. It seems to work, except, it can't seem to find the "gen_hdr.txt" or gen_ftr.txt" files. What should the path be? I tried removing the "header/" path and then a copy of "gen_hdr.txt" in these directories: cgi-bin/links, cgi-bin/admin, cgi-bin/admin/templates. I couldn't get it to work.

What gives?

PS-Permissions on all four .txt files are 644.
Subject Author Views Date
Thread Add header/footer to CGI file? bhoward 714 Feb 12, 2000, 3:23 PM
Post Re: Add header/footer to CGI file?
Eliot 686 Feb 12, 2000, 3:35 PM