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

Multiple Category Templates

Quote Reply
Multiple Category Templates
i try to use different templates for different purposes. For example, a particular category page may need a different layout than what is used on other category pages.
but not working the followings, pls let me know what's wrong;

my ($tags, $dynamic) = @_;
my $template = defined $dynamic ? $dynamic->param('t') : undef;
(ref $tags eq 'HASH') or croak "HTML_TEMPLATES: Argument '$tags' must be hash reference";

my ($tpl);
my ($name) = $tags->{'category_name'} =~ m,/?([^/])$,;
if ($name =~ /Business_and_Economy/){ $tpl = ' category100.html '; }
else { $tpl = 'category.html'; }

defined $dynamic and &load_user ($dynamic, $tags);
my $output = &load_template ( $tpl, {
%$tags,
build_links_per_page => $LINKS{build_links_per_page},
category_first => $name,
%GLOBALS
}, undef, $template );

defined $dynamic and &clean_output($dynamic, \$output);
return $output;
}

Quote Reply
Re: Multiple Category Templates In reply to
Replace $tpl with $template...


Regards,

Eliot Lee
Quote Reply
Re: Multiple Category Templates In reply to
Eliot,

Thanks for your help.

if category name is '/Business_and_Economy/', no problems.
but if category name is '/Business_and_Economy/Companies/', got an error and category name change to '/Business_and_Economy\/Companies/', not working in that category.

Thanks in advance