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.
Quote Reply
Re: Add header/footer to CGI file? In reply to
Try using the absolute path to the generic files. It really shouldn't matter though. I mean if your other regular header and footer files are working, then the others should work.

Although, in cgi files, they tend to need the abolute path to print files.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. :)
----------------------