Gossamer Forum
Home : Products : Links 2.0 : Discussions :

If I have & in cat. names, none selected?

Quote Reply
If I have & in cat. names, none selected?
If I have a & in the category name and if I enter a site from "add a site" from that category, the drop down category list in the add a site form does not seem to pick that particular category. What gives?
Quote Reply
Re: If I have & in cat. names, none selected? In reply to
I don't know PERL at all, so read this message with caution. I'm
responding in hopes that this thread won't drop out of site, and
that someone can help solve this problem. This is as far as I can get:

Look at the following line in add.cgi, sub main:

my %is_valid = map { $_ => 1 } &category_list;

add.cgi builds an associative array %is_valid using the map function.
map returns a list of all categories in the database, which it obtained
by invoking the category_list subroutine in the db_utils.pl file.
Default input $_ is set to 1 so field 1 of each record is stored--that's
the category name (field 0 is the ID number).

Now look at the following line in add.cgi, sub main:

$is_valid{$1} ? &site_html_add_form ($1) : &site_html_add_form ();

That's a conditional comparison. If the test "$is_valid{$1}" is true,
then sub site_html_add_form (subroutine within site_html_templates.pl)
grabs the add.html template and builds the add a site form with the
current category (stored in $1) automatically filled in.

If the test $is_valid{$1} is false, then sub site_html_add_form grabs
add.html and builds the form with the drop down category list.

Apparently, the test is being evaluated false for some reason. Maybe it's
because "&" is the bitwise logical operator "and" which screws up the test
when it's used in a subcategory name. The test reads to the & in the
subcategory name stored in $1, interprets it as "and", and can't match
characters preceding & "and" characters following & with anything stored
in is_valid, which does not interpret the & to mean "and".

That's a guess. Can anyone help out with this???
Quote Reply
Re: If I have & in cat. names, none selected? In reply to
Thanks Rondald, I thught it was just something I had a problem with, otherwise somone would have replied or so I thought. Anyway, I had not paid much attention to the porblem since, I posted but the problem is still there. I guess a fix would be nice.