Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Regarding templates

Quote Reply
Regarding templates
Hi,

As you can see on my site: http://fanguide.dlrarmy.com I use SSI to call a left and right navigation menu, that SSI calling works on the static pages but not on the ones generated by cgi or something. I first put the SSI tags in every HTML file in the templates (I use templates) directory and tried to see if that worked which didn't.

Then I looked on this forum for a solution and tried to do the following:

in the links.cfg file i added this in the extra paths section:

$leftnav = qq|<include virtual="/leftnav.shtml>|;
$rightnav = qq|<include virtual="/rightnav.shtml>|;

then in the site_html_templates file i added this in the %globals hash:

leftnav > $leftnav
rightnav > $rightnav

and then i just put <%leftnav%> in the html template file where i wanted it and tried if that worked which it didnt either.


So is there anyone that can help me with this, i've looked and tried stuff that's mentioned here on the forums but nothing worked so far. I prolly did something wrong so if anyone had the same problem and got it to work please could you tell me the solution cuz this is making me nuts.

Kind Regards,

Mephit

Quote Reply
Re: Regarding templates In reply to
Search the Links 2.0 Customization Forum for header footer Bobsie and you will find a Thread where codes are provided to include "header" and "footer" files in cgi generated scripts.

You cannot use SSI calls in cgi scripts, but you can create subs that opens files and then prints the text from those files and then you can create global tags that can be placed in ALL your template files.

Read the Thread that I refer to and you should be on your way.

Regards,

Eliot Lee
Quote Reply
Re: Regarding templates In reply to
Yea I know about that and I must have read it 20 times by now, I tried to do that but it still won't work. I think i'm doing something wrong with the definition part or i just don't get it.

$leftnav = qq|????|; what do i have to put where the ?'s are? is that where the SSI include goes or something? I just don't see how that thread can help me, they jump from one thing to another and for a newbie like me it's too hard to understand.


Quote Reply
Re: Regarding templates In reply to
In Reply To:
$leftnav = qq|????|; what do i have to put where the ?'s are? is that where the SSI include goes or something?
No... SSI includes do not get parsed in CGI scripts.

Method 1:
Code:
sub header {open (INC, "/path/to/file/header.txt") or return "Can't open file: $!";
return join ("", <INC> );
}
Method 2:
Code:
sub header {
$output = qq| Put your HTML codes here. |;
return;
}
For both these methods, you'll need to do the following:

In globals, add:
Code:
header => &header
and in templates:
Code:
<%header%>
Method 3:
Using the Enhanced Template Mod, upload a file to your templates directory.
In your templates, use:
Code:
<%include header.txt%>
Method 4: (category pages only)
Add HTML codes directly to the Header and Footer fields in the category database, or upload header and footer files to the header and footer directories, and put the name of the file to be included in the Header and Footer fields.

In your templates, use:
Code:
<%header%>
Enough options?

Happy Coding,

--Drew
http://www.FindingHim.com