Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Using same header/footer in Community and Links

Quote Reply
Using same header/footer in Community and Links
I would like to use the same header file in both GCommunity and GLinks, preferable include_header and include_footer which I am using in GLinks. Is there a way to include these files instead of having to make a duplicate copy for both? I'm not sure SSI would work.
Quote Reply
Re: [Jobu] Using same header/footer in Community and Links In reply to
You could use a template global to handle that...

Code:
sub {
my $template = shift;
my $path = '/path/to/other/templates';
my $tpl;

open (TPL, $path . "/" . $template) or return "Cannot load file $path\/$template. $!";
while (<TPL>) { $tpl .= $_; }
close (TPL);

return $tpl;
}

It would be nice if <%include%>'s supported this by default.

Philip
------------------
Limecat is not pleased.
Quote Reply
Re: [fuzzy logic] Using same header/footer in Community and Links In reply to
You can include from absolute/relative paths as long as it's not done via a variable. eg. you can do <%include /path/to/other/templates/foo.html%>, but you can't do <%set tpl = "/path/to/other/templates/foo.html"%><%include $foo%> due to security restrictions.

Adrian
Quote Reply
Re: [brewt] Using same header/footer in Community and Links In reply to
hm... okay, the template tuturial is incorrect then:

Quote:
...will include either the file info.txt (if info is true) or noinfo.txt (if info is false or not set). It must be in the template's root directory which is defined using $obj->root, or '.' by default.

Philip
------------------
Limecat is not pleased.
Quote Reply
Re: [brewt] Using same header/footer in Community and Links In reply to
In Reply To:
You can include from absolute/relative paths as long as it's not done via a variable. eg. you can do <%include /path/to/other/templates/foo.html%>, but you can't do <%set tpl = "/path/to/other/templates/foo.html"%><%include $foo%> due to security restrictions.


I tried to include:

/var/home/user/wiredbiz.com/cgi-bin/links/admin/templates/luna/include_header.html

And got a "no such file" or directory error. Where do I need to start the path from?

I also put a header file in my www directory, and tried:

/var/home/user/wiredbiz.com/www/include_header.html

and

/include_header.html

And no luck.

Thanks!
Quote Reply
Re: [Jobu] Using same header/footer in Community and Links In reply to
I think you need to add local:

Code:
<%include /var/home/user/wiredbiz.com/cgi-bin/links/admin/templates/luna/include_header.html%>

<%include /var/home/user/wiredbiz.com/cgi-bin/links/admin/templates/luna/local/include_header.html%>

I've tried it and it works ok.
Quote Reply
Re: [MJB] Using same header/footer in Community and Links In reply to
In Reply To:
I think you need to add local:

Code:
<%include /var/home/user/wiredbiz.com/cgi-bin/links/admin/templates/luna/include_header.html%>

<%include /var/home/user/wiredbiz.com/cgi-bin/links/admin/templates/luna/local/include_header.html%>


I've tried it and it works ok.


That did the trick! Thanks.