Gossamer Forum
Home : Products : Links 2.0 : Customization :

header and footer

Quote Reply
header and footer
Hey,

I successfully installed Links 2.0....Now what i need to change is the appearance so that the links appear within the template. I was told i need to change the header and footer file. How do go about doing this? Was there one i might of uploaded that i can change or do i need to create one? How do i create a header and footer. Thanks for your help.

Quote Reply
Re: header and footer In reply to
Links 2.0 displays pages in one of two ways:

1. Templates, and
2. Customer headers and footers.

The default is templates. These are located in your /links/admin/templates directory. The script that parses these is called site_html_templates.pl. site_html is used with headers and footers only.

I guess that you are using the templates because that is the default option. Just edit the HTML in the templates as any other page. Just make sure that you don't remove any of the markup like this: <%site_title%>.

Martin Webster
--
Cebidae's UK Internet Resource
http://www.cebidae.co.uk/
Quote Reply
Re: header and footer In reply to
Ummm, where did you get the idea that using templates excludes headers and footers? You can do both. Here is the scoop on headers and footers:

1. There are category headers and footers which are defined in category.def and appear in the add and modify a category displays on the admin screen. One of two things can go into those fields when adding/modifying a category:

a. The name of a file which is contained in a links/admin/header or links/admin/footer directory. These files can contain plain text or html.

b. HTML code or text that you want to display as a category header or footer. I do recommend doing this; it is better to create separate header and footer files and putting the in the directories mentioned above and point to them by putting the name of the file (excluding the path) in the fields.

When the category pages are built, Links looks in these fields for each category. No matter what is in the field, Links will see if it matches a header or footer file in the appropriate directory. If it does, then the contents of that file will be used. If it does not, then whatever is in the field will be used. To use the fields with templates, the <%header%> or <%footer%> tags should be in the category.html template file in the position where you want the header or footer to display. If not using templates, then $header and $footer are used instead of the tags (in sub site_html_category, site_html.pl).

2. You can also create headers and footers that will be used for all (or most) Links pages by including them as variables at the top of site_html.pl or site_html_templates.pl (above the %globals = ( line, something like this (as used on my site):
Code:
$site_menu = qq~[
<a href="$build_add_url">Add</a> |
<a href="$build_modify_url">Modify</a> |
<a href="$build_new_url/$build_index">New</a> |
<a href="$build_cool_url/$build_index">Cool</a> |
<a href="$build_ratings_url/$build_index">TopRated</a> |
<a href="$build_search_url">Search</a> |
<a href="$build_email_url">Newsletter</a>
]
[
<a href="$build_root_url/GuestBook/$build_index">Guestbook</a> |
<a href="/cgi-bin/BNB/birdcast.cgi">Recommend This Page</a> ]
~;
Then, change this code (if using templates) in site_html_templates.pl:
Code:
%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 => ''
);
to read:
Code:
%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,
site_menu => $site_menu,
banner => ''
);
The tag, <%site_menu%>, can now be used in any template loaded by Links or the variable, $site_menu, can be used in any subroutine of either site_html.pl or site_html_templates.pl.

3. You can use SSI to load any file on any static HTML page created by links, if your Links is configured correctly.

4. You can install the Enhanced Template Mod and then include any file just about anywhere (the files to include MUST be in the templates directory).

So, as you can see, having headers and footers is possible with templates or without templates and there are quite a few ways to implement them.

I hope this helps.

- Bobsie
bobsie@orphanage.com
http://goodstuff.orphanage.com/
Quote Reply
Re: header and footer In reply to
Could someone please add this to FAQ section? I'm sure a lot of people could use this explanation.

Thanks!
Avern

Quote Reply
Re: header and footer In reply to
avern,

Anyone can post relevant and important threads to the FAQ section and submit mods.

For this thread, I would suggest only submitting Bobsies post: http://gossamer-threads.com/p/93547



--Drew
Quote Reply
Re: header and footer In reply to
Is there a way to get your category headers and footers onto your detailed pages?

I have custom footers for each category and I'd love to have them show up on the detailed pages to give a more uniform look, but I can't seem to figure out how to get them in there. The $header variable works fine on a category page, but not on a detailed page. I'm not using templates and I'm wondering if there is a snippet of code I can insert into site_html.pl that will make the script open up the category file, get the header, and stick it into the detailed pages that are under that category.

Any suggestions would be appreciated.

Thanks,
TigerLily :)

Quote Reply
Re: header and footer In reply to
Bobsie mentioned in step 2 that you can define a $site_menu

I was wondering if couldn't all this information be pulled to an outside "template.cfg" like the variables used in one of the template mods (either yahoo - or was it webcrawler) oh well that isn't really important since that idea was pretty good and wanted to take it one step further. such as

$menu_navi = qq~
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr valign="middle" align="center">
<td height="20">
<font face="arial" size="2">

Site Navigation : <b><a href="
$build_root_url">Home</a> | <a href="
$build_root_url/New">What's New</a> | <a href="
$build_root_url/Cool">What's Cool</a> | <a href="
$build_root_url/Ratings">Top Rated</a> | <a href="
$build_root_url/Pick">Editor's Pick</a> | <a href="
$db_cgi_url/jump.cgi?ID=random">Random Link</a> | <a href="
$db_cgi_url/search.cgi">Search</a></b>

</font></td>
</tr>
</table>
~;

Sure I could put all this into the site_html_template but it'd only need a require statement???

any suggestions on what's going wrong since I'm getting:
Error including libraries: Bad name after gif' at /home/public_html/cgi-bin/links/admin/templates.cfg line 1315. ahhh, there's no where neat that many lines more like 700 or so, but I do realize that's not where the error is.

I'd really appreciate the help since my cutting pasting and extrememly limited perl knowledge has just run out, of course the trial and error is coming to an end since I've found most of the common mistakes that I know about.



Quote Reply
Re: header and footer In reply to
dah,
not that stupid after all, I was declaring a print statement for my java meta tags and scripting function when they should have declared as variables using a single quote while I was declaring them as perl print qq statements.

life sucks when you don't know perl.

any other suggestions for this idea, it's working but I'd really appreciate the extra comments

thanks

Quote Reply
Re: header and footer In reply to
Bobsie said in his post above:

3. You can use SSI to load any file on any static HTML page created by links, if your Links is configured correctly.

--
Question: what about SSI on cgi-generated pages, e.g. the search pages? How can SSI be used on those?

I need to use SSI rather than headers/footers because I don't simply need to include some text or HTML on my pages - I need to call a cgi program that will display my rotating ad banners. The ad script I'm using requires SSI. This is fine for all the static pages generated by Links (as long as they end in .shtml) but it's not working on the cgi pages like search, search results, etc, even though I added the SSI to the appropriate templates.

Help, please?

TIA

Quote Reply
Re: header and footer In reply to
In Reply To:
what about SSI on cgi-generated pages, e.g. the search pages? How can SSI be used on those?
You don't use SSI call codes...you simply use the GLOBAL tags, like:

Code:

<%site_menu%>


as Bobsie clearly stated above.


Regards,

Eliot Lee
Quote Reply
Re: header and footer In reply to
Hello

I followed your explanation but here's what happen. I have a folder HEADER and another FOOTER. In HEADER i got files like H1.txt, H2.txt etc.
In my admin area in the field HEADER I can only enter H1.txt, all other files never show up (H2.txt etc.).
Obviously the script take ONLY the first file found in the folder.
I am not using templates.

Do you know HOW to solve this problem?

I am pulling my hairs!

Thanks

BTW: I use SSI and entering a call to execute a script or "include virtual" doesn't work in header fields.


Quote Reply
Re: header and footer In reply to
You need to have the following codes in your sub site_html_category routine in the site_html.pl...

Code:

~;
if ($header) {
$output .= qq~<h2>$header</h2>~;
}


AND

Code:

~;
if ($footer) {
$output .= qq~<h2>$footer</h2>~;
}


These codes SHOULD already be in that subroutine...unless you have deleted them.

AND since it seems that you are experiencing difficulties with customizing Links, you MIGHT want to consider using TEMPLATES.

And in the future, please add replies to your ORIGINAL threads.

Regards,

Eliot Lee
Quote Reply
Re: header and footer In reply to
The codes (~; if ($header) { $output .= qq~<h2>$header</h2>~; }) are in my site_html.pl.

In my folder HEADER I have more than one text file and obviously the script read only the first one, that's the problem because I can't call different headers for different categories.

I have been looking for an answer all over the forum, FAQ, resources etc. I cannot be the only one having this problem and I hope there is another solution than having to use templates! That's why I post my Q. here in the FAQ that explain how to do it.

If you are using the HEADER folder with several txt files and that it work please let me know how you did it.

Thanks

Quote Reply
Re: header and footer In reply to
And you have simply typed h1.txt or h2.txt in the Header field via admin.cgi, right?

If you have done this and your header/footer files are in the HEADER/FOOTER directories, then I don't know what to tell ya.

Good luck!

Regards,

Eliot Lee
Quote Reply
Re: [Bobsie] header and footer In reply to
In Reply To:

Hello I'm trying to add indivdual banners in each category/sub-category. If I understand correctly, I should create a txt or html file for each category/sub-category and place it into the appropriate directory. On my category.html template in the location I want the banner to display, I insert a <%header%> tag now reading the following, I get lost
"b. HTML code or text that you want to display as a category header or footer. I do recommend doing this; it is better to create separate header and footer files and putting the in the directories mentioned above and point to them by putting the name of the file (excluding the path) in the fields".

What is meant by "and point to them by putting the name of the file (excluding the path) in the fields". What fields? I tried modifying via admin panel but get an error that the meta tags are to long. The meta tags were already there (I'm using the clickbank script) I just want to add the info into the header fields. Can anyone please explain it to me, remember, I am a novice Unsure Thanks. Taipan
"There's been an explosion! Your site has been inundated, and profits are going through the roof."
http://cbbomb.com

Host you BOMB on the server specifically designed for BOMBERS, CBBOMBER Domains and Hosting http://cbbomber.com
Quote Reply
Re: [taipan] header and footer In reply to
OK, I have not used this method, but it looks like this, I think:

a. The name of a file which is contained in a links/admin/header or links/admin/footer directory. These files can contain plain text or html.

b. HTML code or text that you want to display as a category header or footer. I do NOT recommend doing this; it is better to create separate header and footer files and putting the in the directories mentioned above and point to them by putting the name of the file (excluding the path) in the fields.

So, you need two directories, "links/admin/header" and "links/admin/footer".

Then, in the fields in the admin, for each category, enter a name for the header, one for all, or different ones as desired:

cat1 header=cat1.txt

cat1 footer=cat1.txt

cat2 header=cat2.txt

cat2 footer=cat1.txt

Of course you also need the file cat1.txt (whatever...) etc in the correct directory. It will be an HTML file...


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] header and footer In reply to
Thanks for your input, this may be the way to go but since I am using links with a Clickbank script the metatags were already preset. I dont know how he did it because links returns an error whenever I enter a cat. header name. The error, and I'm parapharsing here, is that the metatags are to long, only allowed 75 characters.



Taipan Crazy
"There's been an explosion! Your site has been inundated, and profits are going through the roof."
http://cbbomb.com

Host you BOMB on the server specifically designed for BOMBERS, CBBOMBER Domains and Hosting http://cbbomber.com
Quote Reply
Re: [Bobsie] header and footer In reply to
b. HTML code or text that you want to display as a category header or footer. I do recommend doing this; it is better to create separate header and footer files and putting the in the directories mentioned above and point to them by putting the name of the file (excluding the path) in the fields.


Please explain. I edited the category.db and placed in each cat/sub-cat header a name. I re-built the links and in each cat/sub-cat the name of the header appears where the header should be. I quess I did this part right. My question is where do I insert the actual files? I created a header and footer folder in the links/admin inside those folders I inserted the folders for each cat/sub-cat containing the files whose name I entered in the header field within the db. Why isnt the header showing up? I still see the name of the header field rather than the html in the file by the same name.

Any insight would be great.

Thanks,

Taipan Unimpressed
"There's been an explosion! Your site has been inundated, and profits are going through the roof."
http://cbbomb.com

Host you BOMB on the server specifically designed for BOMBERS, CBBOMBER Domains and Hosting http://cbbomber.com
Quote Reply
Re: [PerlFlunkie] header and footer In reply to
In Reply To:
... So, you need two directories, "links/admin/header" and "links/admin/footer".

Then, in the fields in the admin, for each category, enter a name for the header, one for all, or different ones as desired:

cat1 header=cat1.txt

cat1 footer=cat1.txt

cat2 header=cat2.txt

cat2 footer=cat1.txt

Of course you also need the file cat1.txt (whatever...) etc in the correct directory. It will be an HTML file... Ok, I edited the header field for each category/subcategory. Then I created a txt file by the same name (not using footers yet). Then I created a folder for the category and placed all the txt files for the category in that folder. then I ftp that folder into a folder called header in links/admin/ so why doesnt it work?
"There's been an explosion! Your site has been inundated, and profits are going through the roof."
http://cbbomb.com

Host you BOMB on the server specifically designed for BOMBERS, CBBOMBER Domains and Hosting http://cbbomber.com
Quote Reply
Re: [taipan] header and footer In reply to
Quote:
Then I created a folder for the category and placed all the txt files for the category in that folder. then I ftp that folder into a folder called header in links/admin/ so why doesnt it work?


Not sure what you did...

You only need one header folder and one footer folder, like so: /links/admin/header and links/admin/footer. Then suppose you have three different headers, head1.txt, head2.txt, and head3.txt. All three go into the one header folder. Then, for each (sub)category, enter the name of the file you want to use, example: head2.txt

You have the call tag <%header%> in the code, it seems, since you can see the file name. (Your'e using templates?)


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] header and footer In reply to
In Reply To:
Quote:
Then I created a folder for the category and placed all the txt files for the category in that folder. then I ftp that folder into a folder called header in links/admin/ so why doesnt it work?


Then, for each (sub)category, enter the name of the file you want to use, example: head2.txt


Ok I understand that I only need one header file links/admin/header. But then what? There are 5235 links in 10 categories. Where do I enter the name of the file you want to use, example: head2.txt, for each (sub)category. Do I rename the header fields. Say I create 10 header.txt docs, one per category. Say gambling is header1.txt do I rename the header field in the gambling sub-categories header1.txt? Do I get it finally?

Thanks very much.
"There's been an explosion! Your site has been inundated, and profits are going through the roof."
http://cbbomb.com

Host you BOMB on the server specifically designed for BOMBERS, CBBOMBER Domains and Hosting http://cbbomber.com
Quote Reply
Re: [taipan] header and footer In reply to
sounds like it... is it working for ya?


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] header and footer In reply to
In Reply To:
sounds like it... is it working for ya?
Wink yup! your last comment made it all click. I want to thank you and everyone on this board for being so, well cool! I have the headers just like I want them.

Thanks a bunch.

Taipan

aka Gil Cintron
"There's been an explosion! Your site has been inundated, and profits are going through the roof."
http://cbbomb.com

Host you BOMB on the server specifically designed for BOMBERS, CBBOMBER Domains and Hosting http://cbbomber.com