Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Re: [jeffb] Category Template - Don't want subs to inherit

Quote Reply
Re: [jeffb] Category Template - Don't want subs to inherit In reply to
So you want to use one template for everything except for the leaf (in tree terminology) categories?

So for something like:
Code:
A
+-B
+-C
| +-D
| | --E
| --F
--G
--H
A, C, D, G would use one template and B, E, F, H would use another?

If that's the case, that that would be relatively easy to fix by writing a global that sees if the current category has any children. Something like:
Code:
sub {
my $cat_id = shift;
return $DB->table('Category')->count({ FatherID => $cat_id });
}
Then in the templates, do something like:
Code:
<%set children = children_count($ID)%>
<%if not children%><%include child_category.html%><%endparse%><%endif%>

Adrian
Subject Author Views Date
Thread Category Template - Don't want subs to inherit Chrisp 4704 Sep 4, 2005, 8:21 AM
Thread Re: [Chrisp] Category Template - Don't want subs to inherit
brewt 4583 Sep 4, 2005, 2:42 PM
Post Re: [brewt] Category Template - Don't want subs to inherit
Chrisp 4561 Sep 4, 2005, 2:55 PM
Thread Re: [brewt] Category Template - Don't want subs to inherit
jeffb 4438 Oct 3, 2006, 6:25 AM
Thread Re: [jeffb] Category Template - Don't want subs to inherit
brewt 4458 Oct 3, 2006, 4:13 PM
Thread Re: [brewt] Category Template - Don't want subs to inherit
jeffb 4443 Oct 4, 2006, 5:04 AM
Thread Re: [jeffb] Category Template - Don't want subs to inherit
brewt 4416 Oct 4, 2006, 6:06 PM
Post Re: [brewt] Category Template - Don't want subs to inherit
jeffb 4432 Oct 5, 2006, 8:20 AM