Hi...I'm trying to make this modification that handles multiple "Link" and "Category" tables as being different sections. I have all the mods completed that separate and build the different sections but can't figure out a couple things. How does the Category list get built?
sub get_category_list {
# --------------------------------------------------------
# Builds a <select> list of category name to category id.
#
my $value = shift;
my $fname = shift | | 'CategoryID';
my $mult = shift | | '';
$mult and ($mult = "MULTIPLE SIZE=4");
my ($query, $sth, $id, $name, $output, $time);
my $cat_table_name_to_use = "$ENV{'REMOTE_USER'}cat";
# Explain: All sections are based on
# the value of REMOTE_USER and their
# respective categories have cat
# following them. IE: Storecat, Calendarcat, etc...
# $output = $CATEGORY_LIST{$value,$fname};
$time = time();
if (!$output) {
if (! $CATDB) {
$CATDB = new Links: : DBSQL $LINKS{admin_root_path} . "/defs/$ENV{'REMOTE_USER'}cat.def";
}
$query = qq!
SELECT ID, Name
FROM $cat_table_name_to_use
ORDER BY Name
!;
$sth = $CATDB->prepare ($query);
$sth->execute() or die "Can't Execute: $DBI::errstr";
$output = "<select $mult name='$fname'><option value=''>----";
while (($id, $name) = $sth->fetchrow_array) {
($id == $value) ? ($output .= "<option value='$id' SELECTED>$name") : ($output .= "<option value='$id'>$name");
}
$output .= "</select>";
$sth->finish;
$CATEGORY_LIST{$value,$fname} = $output;
}
return $output;
}But the Category list is still showing up as a text input box, is there a different way I need to define the $cat_table_name_to_use?
I am stumped...
[This message has been edited by phoule (edited January 03, 2000).]
[This message has been edited by phoule (edited January 03, 2000).]
Code:
Here is the code I am trying: sub get_category_list {
# --------------------------------------------------------
# Builds a <select> list of category name to category id.
#
my $value = shift;
my $fname = shift | | 'CategoryID';
my $mult = shift | | '';
$mult and ($mult = "MULTIPLE SIZE=4");
my ($query, $sth, $id, $name, $output, $time);
my $cat_table_name_to_use = "$ENV{'REMOTE_USER'}cat";
# Explain: All sections are based on
# the value of REMOTE_USER and their
# respective categories have cat
# following them. IE: Storecat, Calendarcat, etc...
# $output = $CATEGORY_LIST{$value,$fname};
$time = time();
if (!$output) {
if (! $CATDB) {
$CATDB = new Links: : DBSQL $LINKS{admin_root_path} . "/defs/$ENV{'REMOTE_USER'}cat.def";
}
$query = qq!
SELECT ID, Name
FROM $cat_table_name_to_use
ORDER BY Name
!;
$sth = $CATDB->prepare ($query);
$sth->execute() or die "Can't Execute: $DBI::errstr";
$output = "<select $mult name='$fname'><option value=''>----";
while (($id, $name) = $sth->fetchrow_array) {
($id == $value) ? ($output .= "<option value='$id' SELECTED>$name") : ($output .= "<option value='$id'>$name");
}
$output .= "</select>";
$sth->finish;
$CATEGORY_LIST{$value,$fname} = $output;
}
return $output;
}
I am stumped...
[This message has been edited by phoule (edited January 03, 2000).]
[This message has been edited by phoule (edited January 03, 2000).]