Hi,
Add a new field via
Database > Category > Properties > Add Column, called
CatIsPriority (INT SELECT 1/0Yes/No)
Then, you can use this global:
sort_out_cat_loops
Code:
sub {
my $father_id = $_[0] || 0;
my $tbl = $DB->table('Category');
$tbl->select_options('ORDER BY Name');
my (@norm_loop, @priority_loop);
my $sth = $tbl->select( { FatherID => $father_id, CatIsPriority => 1 } ) || die $GT::SQL::error;
# get priority loop of cats
while (my $hit = $sth->fetchrow_hashref) {
$hit->{URL} = $CFG->{build_root_url} . "/" . $DB->table('Category')->as_url( $hit->{Full_Name} ) . "/" . $CFG->{build_index};
push @priority_loop, $hit;
}
# now get normal categories
my $sth = $tbl->select( { FatherID => $father_id, CatIsPriority => 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};
push @norm_loop, $hit;
}
return { priority_loop => \@priority_loop, norm_loop => \@norm_loop };
}
Then call with:
Code:
<%sort_out_cat_loops($category_id)%>
<%if priority_loop.length%>
<%loop priority_loop%>
<%include subcategory.html%>
<%endloop%>
<%endif%>
<%if norm_loop.length%>
<%loop norm_loop%>
<%include subcategory.html%>
<%endloop%>
<%endif%>
Untestd, but should work =)
Cheers
Andy (mod)
andy@ultranerds.co.uk
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work! 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! Compare our different Plugin packages *new* Free CSS Templates