Gossamer Forum
Home : Products : Gossamer Links : Discussions :

category table tags

Quote Reply
category table tags
How can i display tags from my category table in the modify template?
Quote Reply
Re: [xpert] category table tags In reply to
Hi

The modify form is forthe links only...

What fields are you trying to implant?
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [katabd] category table tags In reply to
It's a custom column i addd into the cat table!
Quote Reply
Re: [xpert] category table tags In reply to
Ok there is Links, category and relation tables...

The add.cgi handles additiont to the links and relation tables so changing or adding a field through the add form to the category links will not work...

Depedning on what you are trying to do...

If it is a custom tag per user you can use the users table... or else you will have to be more specific as to what kind of field it is...
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [katabd] category table tags In reply to
Alright let say the custom column is the description column of the Category table!
Quote Reply
Re: [xpert] category table tags In reply to
Ok if i understood correctly...

Editing the catgeory variables is not done through the modify template..

there is one of two ways I know of to do that:

1- To assign the user as an editor to the category you want them to edit.

2- To get a plug in similar to the Users plug in i have for the category editing...
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [katabd] category table tags In reply to
No I'm not trying the edit the description. I'm tryin to display the description of the the category the link is in on the modify templates!
Quote Reply
Re: [xpert] category table tags In reply to
Use this global (use as <%get_category_tags%>)
Code:
sub {
my $tags = shift;
return $DB->table('Category')->get($tags->{'CatLinks.CategoryID'});
}

Ivan
-----
Iyengar Yoga Resources / GT Plugins

Last edited by:

yogi: Aug 18, 2002, 1:56 AM
Quote Reply
Re: [yogi] category table tags In reply to
Hey Yogi,

Thanks for the help, however I can encounter another problem, once i start the get_category_tags global I couldn'y use the Description tag of Links table!
Quote Reply
Re: [xpert] category table tags In reply to
That's because you have a namespace clash between 'Description' of the category and 'Description' of the link.

You could prefix the fields by something like 'category_'.
Code:
sub {
my $tags = shift;
my $cat = $DB->table('Category')->get($tags->{'CatLinks.CategoryID'});
return { map { 'category_' . $_ => $cat->{$_} } keys %$cat };
}

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] category table tags In reply to
>>
map { 'category_' . $_ => $cat->{$_} } keys %$cat
<<

Remember that will cause an error (you posted a thread on it a while back).

You need to change the context so you'd use:

map { +"category_$_" => $cat->{$_} } keys %$cat
Quote Reply
Re: [Paul] category table tags In reply to
Actually, it will not.

map { "category_$_" => $cat->{$_} } keys %$cat

would cause an error, though.

Related question: is there a difference between

map +{ "category_$_" => .....

and

map { +"category_$_" => ....

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] category table tags In reply to
Yeah my bad I was thinking of the example you showed rather than the one that appends.

Regarding:

map +{ "category_$_" => .....

and

map { +"category_$_" => ....

....the difference is that the first example creates an anonymous hashref whereas the second one doesn't.

For example in a script Im writing at the moment, in order to generate a template loop (arrayref of hashrefs) I use:

Code:
my $array_ref = $something_from_mysql;
my $loop = [ map +{ tag => $_->[0] }, @$array_ref ];

If I left out the + I'd have an arrayref and with the + in the other place I'd get the same

Also note that with +{ you need the comma after the }

Last edited by:

Paul: Aug 24, 2002, 1:04 PM
Quote Reply
Re: [Paul] category table tags In reply to
Paul, thanks for the explanation. I'll experiment with it.

Ivan
-----
Iyengar Yoga Resources / GT Plugins