Hi,
Well, it can be done with a global - but its a little tricky in terms of getting them in 2 columns (putting them in a single column is a piece of cake)
get_2_types_cats
Code:
sub {
my $tbl = $DB->Table('Category');
$tbl->select_options('ORDER BY Name ASC');
my (@loop,@loop2);
my $sth = $tbl->select( { FatherID => $_[0] } ) || die $GT::SQL::error;
while (my $hit = $sth->fetchrow_hashref) {
$hit->{URL} = $CFG->{build_root_url} . '/' . $DB->table('Category')->as_url($hit->{Full_Name}) . '/' . $CFG->{build_index};
if ($hit->{
YourField} eq "Yes") {
push @loop, $hit;
} else {
push @loop2, $hit;
}
}
return { Category_Loop_1 => \@loop , Category_Loop_2 => \@loop2 }
}
CHANGE THE BIT IF RED TO THE NAME YOU GAVE YOUR FIELD! ..call with this in category.html
Code:
<%get_2_types_cats($ID)%>
<%if Category_Loop_1.length%>
<h2>Categories with "Yes"</h2>
<%loop Category_Loop_1%>
<%include subcategory.html%>
<%endloop%>
<%endif%>
<%if Category_Loop_2.length%>
<h2>Categories with "No"</h2>
<%loop Category_Loop_2%>
<%include subcategory.html%>
<%endloop%>
<%endif%>
This will ONLY put them in a single column though - i.e
<h2>Categories with "Yes"</h2>
xx
xx
xx
xx
xx
<h2>Categories with "No"</h2>
xx
xx
xx
xx
xx
Hope that helps.
Cheers
Andy (mod)
andy@ultranerds.com Merry Xmas and a Happy New Year!
Want to give me something back for my help? Please see my
Amazon Wish List GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500) Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin |
Pre-Made Template Sets |
FREE GLinks Plugins! Custom Toolbar for IE and Firefox! -
Compare our different Plugin packages *new*
Free CSS Templates