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

Using templates for rest of site

Quote Reply
Using templates for rest of site
This may be a general CGI question as opposed to Links SQL-specific, but I thought I'd pose it.

How can I create new templates that will be able to utilize the header/footers as specified in the LINKS SQL templates directory? For instance, if I create a bunch of new pages that I want to look similar to the rest of my site, how can I create HTML files that will call a header/footer so that I need to change everything when I make a change to these?

I am assuming creating a new template, including the header/footer, and simply accessing the file will not work.

Thanks!

Quote Reply
Re: Using templates for rest of site In reply to
I read this 3 times, and I'm still lost.

Can you try explaining it again?



Quote Reply
Re: Using templates for rest of site In reply to
Hi Pugdog,

Sorry, I suppose I could have been more clear!

What I want to do is create a page separate from Links SQL and my directory. For instance, I would like to have a "Contact Us" page and submission form. However, I would like this page to utilize the same header and footers as does Links SQL (i.e. my navigation links).

I see that the Links SQL templates are built and filled by CGI scripts (i.e. add.cgi -> add.html) and must somehow replace the <%include footer.txt%> tag with the real footer. How can I use the same tag (<%include footer.txt%> ) from a web page that I have created myself, that has nothing to do with Links SQL and its scripts?

As it is, I put this page (along with others like it) in my default home directory (whereas Links SQL and its files are in the cgi-bin directory). What I'm looking to do is to have all my web pages, whether Links SQL templates or not, be able to utilize the headers and footers of Links SQL such that I will not have to change all my non-template pages when the navigation links change.

Does this make more sense? Your help is much appreciated.

Quote Reply
Re: Using templates for rest of site In reply to
You can't.

An HTML page is just "read" from the disk, while the cgi-generated pages are put together each time.

You could use SSI if your server is enabled that way, or just create the page, and fill it in. When I need a static page for some information or copyright reason, I just save one of the pages closest to it (usually my search or add page) and then replace the content area with what I want to say. All the other stuff is encoded, and the page looks like part of the site.


Quote Reply
Re: Using templates for rest of site In reply to
As pugdog mentioned...SSI is your answer...

I have common header and footer files for all my pages in my LINKS directory (some of them not generated by nph-build.cgi).

There is a FAQ about Header and Footer files in the Links 2.0 section of the Resource Center.

Regards,

Eliot Lee
Quote Reply
Re: Using templates for rest of site In reply to
Hi Canucks

If you are willing to modify the nph-build.cgi and HTML_Templates.pm scripts it is possible.

Thinking about it...it is a good idea to use templates for the rest of the static pages...I will write this mod this morning.

If anyone is interested I will post it here.

..after my second cup of coffee.

regards, alexander

Quote Reply
Re: Using templates for rest of site In reply to
Isn't that what page.cgi is all about?

I'm getting lost here. If you want to generate a static page, just do it. If you want to have a dynamically updated page, just add a routine to the nph-build.cgi (and there are a dozen examples of that already in various ways).

If you want to just have a single dynamic page, use page.cgi and use a static header.

If this is what you want, what I'd do is modify page.cgi to just display static pages dynamically, and have it ignore all the other pages in the site.


Quote Reply
Re: Using templates for rest of site In reply to
Hi,

as far as I undestood Canucks, he has several static pages like (about_us.html, contact.html, restrictions.html ...) where he wants to use the sitewide menus, colors etc.

So if he now changes the menus (header.txt) or other tags he has to change them manually in the static pages.

I also had this problem. I solved it this way:

When I rebuild the whole site, the static pages are also generated from templates. With the possibility to turn off/on this function in Links.pm.

regards, alexander

Quote Reply
Re: Using templates for rest of site In reply to
Alexander... you were correct in your understanding. However, I seem to have fixed the problem simply by mirroring the Links SQL headers and footers and using SSI to includ them. Works like a charm!