Gossamer Forum
Home : Products : Links 2.0 : Customization :

template for category/ subcategory/ deep subcategory

Quote Reply
template for category/ subcategory/ deep subcategory
Hello all,

How I can added template for category in deep level:

in "site_html_templates.pl"

if ($category_name =~ /^Software/) {
$template = "cat1.html"; }
if ($category_name =~ /^Software\/Utilities/) {
$template = "category.html"; }

OK, but Next Level ... ?

if ($category_name =~ /^Software\/Utilities/ DOWNLOAD ) {
$template = "download.html"; }

Thanks,
carlosca
Quote Reply
Re: [carlosca] template for category/ subcategory/ deep subcategory In reply to
carlosca,

You need to reverse the order and make them compound if statements, something like this:

Code:
if ($category_name =~ /^Software\/Utilities\/DOWNLOAD/) {
$template = "download.html"; }
elsif ($category_name =~ /^Software\/Utilities/) {
$template = "category.html"; }
elsif ($category_name =~ /^Software/) {
$template = "cat1.html"; }

That makes every condition unique. The way you had it, every category beginning with "software" would match each if condition regardless of whether or not there were sub-categories.

This is basically the same as the Using Multiple Category Templates mod I wrote located at http://www.gossamer-threads.com/...rces/jump.cgi?ID=970

I hope this helps.

Bob Connors aka Bobsie

Last edited by:

Bobsie: Mar 8, 2004, 10:56 AM
Quote Reply
Re: [Bobsie] template for category/ subcategory/ deep subcategory In reply to
Thank you Bobsie
carlosca