Gossamer Forum
Home : Products : Links 2.0 : Customization :

Header and Footer File?

Quote Reply
Header and Footer File?
Hi -

Is there a way to create a header and footer file that can be set to the default in site_html.pl? I am not looking for much diversity in the pages and would rather just set down the format in one or two .txt header/footer files. I bet this is pretty simple, but I just not sure how to do it. If this has been posted here before a referral will do nicely. Thanks in advance for any help you can offer.

Sincerely,

Matthew Clapp
http://www.jungindex.net/
Quote Reply
Re: Header and Footer File? In reply to
Sure. In the Globals section of site_html.pl, just put in two variables for your header and footer code. Something like:

$site_header = qq|html code goes here|;
$site_footer = qq|html code goes here|;

Then, anywhere you want to use them in site_html.pl, just put $site_header for the header, and $site_footer for the footer. They will display on that page in that location.
Quote Reply
Re: Header and Footer File? In reply to
How would you do this using templates?
Where does the definition go, and where does the header & footer files go

thanks
Lost Babalon Wink
Quote Reply
Re: Header and Footer File? In reply to
Babalon,

As I stated previously, put the $site_header and $site_footer variables in the Globals section near the top of site_html_templates.pl (above the %globals variable).

Then, modify the %globals variable list to add:

site_header => $site_header,
site_footer => $site_footer,

Now, in any template, wherever you want them to appear, just use <%site_header%> or <%site_footer%>, as appropriate.

I hope this helps.

[This message has been edited by Bobsie (edited March 16, 1999).]
Quote Reply
Re: Header and Footer File? In reply to
i did like you said but it's not working for me. i tried it with html and txt
and everytime the output comes up to be
http://www.mysite.com/headers.txt (or html)

what's in the middle

then
http://www.mysite.com/footers.txt (or html)
did i miss something?
i wish i could fix it because it will save me alot of time in the future
Quote Reply
Re: Header and Footer File? In reply to
theguy,

What are those files? Nothing in this thread said anything about creating any files. Everything that was said goes into a script or template file.

[This message has been edited by Bobsie (edited March 29, 1999).]
Quote Reply
Re: Header and Footer File? In reply to
i'm using links 1.11 and i like to use header.txt and footer.txt
i want to use them in site_html.pl
so i did what you explained but when i build the pages, the outcome is
http://www.mysite.com/headers.txt (or html)

what's in the middle

then
http://www.mysite.com/footers.txt (or html)
what i'm trying to say is that it does not excute the headers nor the footers ... it just prints out the url . i hope you did understand me or did i misunderstand the whole thread?
Quote Reply
Re: Header and Footer File? In reply to
theguy,

Once again, where are those file paths/names coming from? I didn't say anything anywhere in this thread about using files. I only spoke about creating variables to be used in site_html.pl or site_html_template.pl and its associated template files.

Post the code that you created and that returns what you say it does. If you followed what I said, there is no way possible for it to come back saying anything about "http://www.mysite.com/headers.txt" or any other file.

Are you sure you are posting to the correct message thread?

[This message has been edited by Bobsie (edited March 30, 1999).]
Quote Reply
Re: Header and Footer File? In reply to
Hi theguy,

It sounds to me that maybe you are defining the URLs to your header and footer file in the globals. If this is the case, that is why you are seeing them printed out in your pages.

What Bobsie is trying to say is that you have to put the ACTUAL TEXT/HTML in the globals, like

$site_header = qq|ACTUAL TEXT/HTML here|;
$site_footer = qq|ACTUAL TEXT/HTML here|;

Trying to call an external file will not work.

Hope this helps (provided, of course that this is the problem),

Joe
Quote Reply
Re: Header and Footer File? In reply to
If you are currently using SSI on your site you can put this include in the header of footer.


<!--#include virtual="/dir/filename.txt" -->


Quote Reply
Re: Header and Footer File? In reply to
Code:
if (!$header) {
open (FILE, "/home/www/ten-tenths/ssi/header.txt") or die "Can't open header file: $!";
$header = join ("", <FILE> );
close FILE;
}

Is what you need to use an external file called header.txt -- to enter the contents of that file, place $header in the relevant place in site_html.pl

HTH.

------------------
Craig Antill
10 Tenths Motorsport (1.1) - www.Ten-Tenths.com/links/
THE Directory (2.0b3) - www.gardenbuildings.com/


[This message has been edited by Craig Antill (edited March 31, 1999).]
Quote Reply
Re: Header and Footer File? In reply to
Following up on Bobsie's mod on site-wide headers and footers for templates, I found the code works fine -except- for the chosen delimter limitation which causes problems with my footer code, as in...

HOME | Search | Help | etc..

Most may know this, but any delimeter can be used after qq, as in...

qq~HTML code here~

BTW Javascript works great to customize headers and footers based on variables in the individual templates.

[This message has been edited by oldmoney (edited April 11, 1999).]
Quote Reply
Re: Header and Footer File? In reply to
where is the %globals variable, I understand the concept but can not find it?
Quote Reply
Re: Header and Footer File? In reply to
The %globals variable is near the top of site_html_templates.pl. It looks like this in the default script:

Code:
# You can put variables here that you would like to use in any
# of your templates.

%globals = (
date => &get_date,
time => &get_time,
db_cgi_url => $db_cgi_url,
build_root_url => $build_root_url,
site_title => $build_site_title,
css => $build_css_url,
banner => ''
);

I hope this helps.