Gossamer Forum
Quote Reply
Re: [rascal] Fix Global In reply to
In Reply To:
Thanks,

do you know how to bold the main categories?
Hi,

I just sent this to rascal via PM, but thought it would be worth posting here too.

Code:
sub {

my ($category,$output);

my $rootcatcolor = q|green|; # red / blue / orange etc - or hex colors

my $db= $DB->table('Category') || return $GT::SQL::error;
$db->select_options('ORDER BY Full_Name') || return $GT::SQL::error;
my $sth = $db->select( ['ID','Full_Name', 'CatDepth', 'Number_of_Links'] ) || return $GT::SQL::error;

$output .= qq|
<select name="nnn-DeptSelect" onchange="top.location=this.options[this.selectedIndex].value" size="1">
<option selected>Hop to a Category</option>
|;

my $preurl;
$IN->param('d') ?
$preurl = "$CFG->{build_root_url}/" :
$preurl = "$CFG->{db_cgi_url}/page.cgi?d=1;g=";

while (my ($id,$full_name, $depth, $cnt) = $sth->fetchrow_array) {
my $safe_full = $full_name;
my @cut = split /\//, $full_name;
my $back = '';

for (my $i=0; $i < $#cut; $i++) {
$back .= q|&nbsp;&nbsp;|;
}

$back .= $cut[$#cut];

if ($#cut < 1) {
$output .= qq|<option style="color: $rootcatcolor" value="$preurl| .
$db->as_url($safe_full) .
qq|/$CFG->{build_index}">$back ($cnt)</option>|. "\n";
} else {
$output .= qq|<option value="$preurl| .
$db->as_url($safe_full) .
qq|/$CFG->{build_index}">$back ($cnt)</option>|. "\n";
}
}

$output .= qq|</select>\n|;
return \$output;
}

NB: This doesn't make root categories bold, it lets you change the colour of the root categories (just edit $rootcatcolor at the top of the global).

AFAIK, its not actually possible to use "weights" inside a <option ..></option> tag - and I've sure tried =)


Hope that helps someone.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Subject Author Views Date
Thread Fix Global rascal 3883 Dec 22, 2006, 10:43 PM
Thread Re: [rascal] Fix Global
SandraR 3796 Dec 23, 2006, 8:18 AM
Thread Re: [SandraR] Fix Global
rascal 3783 Dec 23, 2006, 4:30 PM
Thread Re: [rascal] Fix Global
SandraR 3778 Dec 23, 2006, 6:21 PM
Thread Re: [SandraR] Fix Global
rascal 3731 Jan 17, 2007, 9:01 PM
Thread Re: [rascal] Fix Global
tandat 3724 Jan 17, 2007, 10:20 PM
Thread Re: [tandat] Fix Global
rascal 3719 Jan 18, 2007, 8:23 AM
Thread Re: [rascal] Fix Global
tandat 3721 Jan 18, 2007, 8:37 AM
Post Re: [tandat] Fix Global
rascal 3696 Jan 18, 2007, 8:47 PM
Post Re: [rascal] Fix Global
Andy 3637 Mar 9, 2007, 12:34 AM