Gossamer Forum
Quote Reply
List of category
When submit a link to the site I want to open the option to submit the link to specific category and all here subcategory. Something like submit_cat(catid). It's like the Load_Category_Dropdown.
Does anyone do it before?
Quote Reply
Re: [nir] List of category In reply to
Sorry not really sure what your asking?

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!
Quote Reply
Re: [Andy] List of category In reply to
Hi
When users submit a link he needs to select a category, now he can select any category in the site. I have one category that I want to give the option the submit and all here subcategory.
Like in this link the user can select any category in the site I want to limit the submit to just one category/
http://demo.gossamer-threads.com/perl/linkssql/add.cgi?ID=23691
Quote Reply
Re: [nir] List of category In reply to
Mmm. not really sure if thats possible.

Why would you want to do that anyway? Tongue

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!
Quote Reply
Re: [Andy] List of category In reply to
I need it to limit the category that user can submit a link.
It needs to be something like this
<select name="CatLinks.CategoryID" size="1" id="CatLinks.CategoryID">
<option selected value="">select category</option>
<option value="1"> &nbsp;&nbsp; cat name 1 </option>
<option value="2"> &nbsp;&nbsp; cat name 2 </option>
<option value="3"> &nbsp;&nbsp; cat name 3 </option>
<option value="4"> &nbsp;&nbsp; cat name 4 </option>
</select>

so actually all it need is to insert in a loop the line
<option value="<%catid%>"> &nbsp;&nbsp; <%catname%></option>
Quote Reply
Re: [nir] List of category In reply to
So basically you want to be able to let users select more than one category?

How about a MULTISELECT , instead of a SELECT field?

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!
Quote Reply
Re: [Andy] List of category In reply to
It sound good, do you think that there is a way to lint the select time, like user can select up to 3 different categoiesy.:)
Quote Reply
Re: [nir] List of category In reply to
Hi,

This would work for a multi-select:

custom_category_list
Code:
sub {

my @ids = $IN->param('CatLinks.CategoryID');

my $exists;
foreach (@ids) { $exits->{$_} = 1; }

my $show_count = $_[0];

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'] ) || return $GT::SQL::error;

my $back;

while (my ($id,$full_name) = $sth->fetchrow_array) {

my $full_name2;
my @cut = split /\//, $full_name;
for (my $i=0; $i < $#cut; $i++) {
$full_name2 .= "&nbsp;&nbsp;";
}

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

if ($exists->{ID}) {
$back .= "<option value=\"$id\">$full_name2</option>";
} else {
$back .= "<option value=\"$id\" selected="yes">$full_name2</option>";
}

}

my $send_back = qq|<select multiple="yes" size="10" name="CatLinks.CategoryID"><option value="">------</option>$back</select>|;

return \$send_back;

}

Then call with:

Code:
<div class="row required clear">
<label for="URL" class="name">Category: <span>*</span></label>
<div class="value">
<%custom_category_list%>
</div>
</div>

This will only work on the add form though - and not modify.

Regarding limiting them to 3 categories - that could be done with some Javascript, but thats a little more complicated, and I don't have time to do that ATM :(

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!
Quote Reply
Re: [Andy] List of category In reply to
Thanks, where I define the category I want to display?

Last edited by:

nir: Jun 25, 2008, 7:20 AM