Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Common headers/footers

Quote Reply
Common headers/footers
I would like to use sitewide headers/footers. In Links2 it is easy (see
http://www.gossamer-threads.com/scripts/resources/Detailed/597.html).
I suppose I need to modify HTML_templates.pm? But I cannot see how to add the globals there. Any suggestions?
Thanks
John
Quote Reply
Re: Common headers/footers In reply to
How about just do:

<%include header.txt%>

<%include footer.txt%>

in your templates and it will include the contents of a header/footer.txt file.

Cheers,

Alex
Quote Reply
Re: Common headers/footers In reply to
Yes, the included file is parsed. So if your header.txt looks like:

Some header: <%db_cgi_url%>

Then that tag will get parsed as well. So the menus is quite easily done. See the yahoo and snap samples that came with 1.1b1 to see how it's done.

Hope this helps,

Alex
Quote Reply
Re: Common headers/footers In reply to
Alex...

Is it theoretically possible to have the program parse the included file for tags?

I think I looked at this once, and the static headers didn't suit my needs.

It would be great to include headers and tags that could be parsed, so that there would be one file that had to be changed, but it would affect all the templates. Right now, it all has to be done in every file if the look of the site is changed.

One great feature would be a "menubar" tag. Where the menu bar could be kept in a file, and used within all the templates with automatic deactivation of the current page.

I'm finding more effort being expended trying to copy tags between templates, when it would be so much easier to maintain and design if the templates could be laid out with <%include%> tags, and only the include files were edited to change the look of the site.

It's one more layer of abstraction, but it would also be one step closer to allowing users to design their front page. If the home.html template only stored the layout, with <%include%> tags where the user selectable options are, the user profile could just contain the paramters for those tags.

I'm not sure I'm expressing this clearly, but as an example, the Search*.html templates might have one header layout, and the add*.html and modify*.html templates may have another etc. But to effect the changes on all the files in each group, only one included file has to be edited. Much less chance of error, and much easier to make modifications.

The headers need to contain tags, so they have to be parsed. One way would be to process the <%include%> tags before processing any of the other tags.