Gossamer Forum
Home : Products : Links 2.0 : Customization :

SELECT MULTIPLE Categories

Quote Reply
SELECT MULTIPLE Categories
Hello

Can anyone tell me how to set up links so a link can be assigned to multiple categories? That would require a multiple select box to be generated for the "Categories" field in the "links.db" form pages.

Can this be done using "links.def" settings, or must one edit db_utils.pl?

I see that the "Related" Field in the "Categories" database uses a multiple select box and can handle multiple category options.

Below are the bits of code in db_utils.pl that appear to do this for the "Related" field.


sub build_select_field at line 176
#####

if (! exists $db_select_fields {$column}) {
$db_select_fields{$db_cols[$db_category]} \
= $db_select_fields{'Mult-Related'} = join (",", &category_list);
}

####
## and again in sub build_html_record_form
## at line 308


# Go through a little hoops to only
# load category list when absolutely
# neccessary.
if ($in{'db'} eq 'links') {
exists $db_select_fields{$db_cols [$db_category]} or \
($db_select_fields{$db_cols [$db_category]} = join (",", &category_list));
}
else {
$db_select_fields{'Related'} or ($db_select_fields{'Related'} = \
$db_select_fields{'Mult-Related'} = join ",", &category_list);
}

Can anyone suggest the correct links.def syntax or the correct changes to make to db_utils.pl.

Am I looking at the wrong pieces of code? What have I missed?

Thanks in advance Smile

Don



[This message has been edited by Don (edited February 02, 1999).]

[This message has been edited by Don (edited February 02, 1999).]
Quote Reply
Re: SELECT MULTIPLE Categories In reply to
Hello Again Smile

A search through the archive shows that this topic has come up before.

Multiple Cats for one link
http://gossamer-threads.com/scripts/forum/archive/links/3853.html

The code is about and Alex was asked whether a Craig Antill could publish it. Perhaps Alex did not see the question because he did not answer.


##########

I will post - as soon as Alex agrees that his modification of the routine in nph-build.cgi can be put into the public domain.

Alex, is this OK ?

##########

Quote Reply
Re: SELECT MULTIPLE Categories In reply to
Here are instructions for making the mod to Links 1.1. It is probably similar in version 2.

http://www.ten-tenths.com/links/mods/multicat/

Quote Reply
Re: SELECT MULTIPLE Categories In reply to
Hi - it /should/ be possible to use that mod for 2.0 unless Alex has changed a lot of it's code.

IIRC though, someone did post at some point saying they thought that Alex had left a lot of code in place in 2.0 which allowed for easy conversion to multi-cat setup. Maybe do a search for multi and 2.0 ?

If you find that post, post the URL of the message here too, could you ?

------------------
Craig Antill
10 Tenths Motorsport (1.1) - www.Ten-Tenths.com/links/
THE Directory (2.0b3) - www.gardenbuildings.com/