Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Re: [Paul] How to replace "get_all_categories" method?

Quote Reply
Re: [Paul] How to replace "get_all_categories" method? In reply to
This is the original code, which should be duplicated if possible, as method with name "get_all_categories2".

Code:
sub get_all_categories {
# -------------------------------------------------------------------
# Returns a select box of all categories.
#
my $self = shift;
my $id = shift;
my $name = shift || 'CatLinks.CategoryID';
my $mult = shift || 5;
my $db = $DB->table ('Category');
my $sth = $db->select ( ['ID', 'Full_Name'] );
my %res = ();
while (my ($id, $name) = $sth->fetchrow_array) {
$res{$id} = $name;
}
return $self->select ( {
name => $name,
values => \%res,
value => $id,
multiple => $mult,
sort => sub { lc $_[0] cmp lc $_[1] }
} );
}

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Subject Author Views Date
Thread; hot thread How to replace "get_all_categories" method? webmaster33 9166 Aug 2, 2002, 3:55 AM
Thread; hot thread Re: [webmaster33] How to replace "get_all_categories" method?
Paul 8918 Aug 2, 2002, 4:01 AM
Thread; hot thread Re: [Paul] How to replace "get_all_categories" method?
webmaster33 8927 Aug 2, 2002, 4:18 AM
Thread; hot thread Re: [webmaster33] How to replace "get_all_categories" method?
Paul 8933 Aug 2, 2002, 4:21 AM
Thread; hot thread Re: [Paul] How to replace "get_all_categories" method?
webmaster33 8967 Aug 2, 2002, 5:34 AM
Thread; hot thread Re: [webmaster33] How to replace "get_all_categories" method?
yogi 8984 Aug 2, 2002, 5:39 AM
Thread; hot thread Re: [yogi] How to replace "get_all_categories" method?
Paul 8897 Aug 2, 2002, 5:41 AM
Thread; hot thread Re: [Paul] How to replace "get_all_categories" method?
yogi 8927 Aug 2, 2002, 5:42 AM
Thread; hot thread Re: [yogi] How to replace "get_all_categories" method?
Paul 8899 Aug 2, 2002, 5:45 AM
Post; hot thread Re: [Paul] How to replace "get_all_categories" method?
yogi 8885 Aug 2, 2002, 5:47 AM
Thread; hot thread Re: [yogi] How to replace "get_all_categories" method?
webmaster33 8919 Aug 2, 2002, 5:54 AM
Thread; hot thread Re: [webmaster33] How to replace "get_all_categories" method?
yogi 8933 Aug 2, 2002, 5:57 AM
Thread; hot thread Re: [yogi] How to replace "get_all_categories" method?
webmaster33 8884 Aug 2, 2002, 6:10 AM
Thread; hot thread Re: [webmaster33] How to replace "get_all_categories" method?
yogi 8940 Aug 2, 2002, 6:12 AM
Thread; hot thread Re: [yogi] How to replace "get_all_categories" method?
webmaster33 8874 Aug 2, 2002, 6:18 AM
Thread; hot thread Re: [webmaster33] How to replace "get_all_categories" method?
yogi 8889 Aug 2, 2002, 6:24 AM
Thread; hot thread Re: [yogi] How to replace "get_all_categories" method?
webmaster33 8913 Aug 2, 2002, 6:44 AM
Post; hot thread Re: [webmaster33] How to replace "get_all_categories" method?
yogi 8800 Aug 2, 2002, 6:46 AM
Post; hot thread Re: [Paul] How to replace "get_all_categories" method?
webmaster33 8898 Aug 2, 2002, 4:21 AM