Gossamer Forum
Home : Products : Gossamer Links : Discussions :

<Ętegory%> Var

Quote Reply
<Ętegory%> Var
Hi
i am trying to make <%Category%> (which is available in add.html available in signup_form.html

can someone give me ahand here please.

Quote Reply
Re: <Ętegory%> Var In reply to
You'd have a problem here, since the sign-up form doesn't know where the person is when they sign up.

You'd have to pass catid back to the signup.cgi scripts, and then look up the category name.

Not sure if this would be easy or not. I haven't messed with the user/sign-up scripts much yet in the 2.0.x version.

PUGDOG® Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum
Quote Reply
Re: <Ętegory%> Var In reply to
I am not sure
but i think adding the following sub to user.cgi will do it

sub _category_list {
# -------------------------------------------------------------------
# Return a list of all the categories.
#
my $category;
if ($CFG->{db_gen_category_list}) {
my $db = $DB->table('Links');
my $html = $DB->html($db, $IN);
my @ids = $IN->param('CatLinks.CategoryID') || $IN->param('ID');
$category = $html->get_all_categories(\@ids, 'CatLinks.CategoryID', 1);
}
else {
my $db = $DB->table('Category');
my $id = $IN->param('CatLinks.CategoryID') || $IN->param('ID');
my $sth = $db->select ( { ID => $id }, ['Full_Name'] );
my ($name) = $sth->fetchrow_array();
if ($name) {
$category = "$name <input type=hidden name='CatLinks.CategoryID' value='$id'>";
}
else {
return;
}
}
return $category;
}



Regards
Abd

http://www.idleb.com
Quote Reply
Re: <Ętegory%> Var In reply to
Ok i found it and works fine:

Copy the above sub into:
Links/Utils.pm
<%then where every you wanna use <%category%> insert:
<%Links::Utils::_category_list%>

see http://www.idleb.com/cgi-bin/links/user.cgi?signup_form=1 for an example



Regards
Abd

http://www.idleb.com
Quote Reply
Re: <Ętegory%> Var In reply to
ok
i tried what you said and it is printing a list of all the categories i have on the page....
any suggestions?

Quote Reply
Re: <Ętegory%> Var In reply to
i think you are entring <%Links::Utils::_category_list%> as an input in the form.

DO NOT DO THAT
Enter <%Links::Utils::_category_list%> where you want it in the form without the <input...> tag since it is a built in tag in the sub.
That should work and I should have mentioned it earlier

Regards
Abd

http://www.idleb.com