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 3329 Sep 4, 2005, 8:21 AM
Thread Re: [Chrisp] Category Template - Don't want subs to inherit
brewt 3250 Sep 4, 2005, 2:42 PM
Post Re: [brewt] Category Template - Don't want subs to inherit
Chrisp 3238 Sep 4, 2005, 2:55 PM
Thread Re: [brewt] Category Template - Don't want subs to inherit
jeffb 3101 Oct 3, 2006, 6:25 AM
Thread Re: [jeffb] Category Template - Don't want subs to inherit
brewt 3099 Oct 3, 2006, 4:13 PM
Thread Re: [brewt] Category Template - Don't want subs to inherit
jeffb 3097 Oct 4, 2006, 5:04 AM
Thread Re: [jeffb] Category Template - Don't want subs to inherit
brewt 3076 Oct 4, 2006, 6:06 PM
Post Re: [brewt] Category Template - Don't want subs to inherit
jeffb 3105 Oct 5, 2006, 8:20 AM