How can i display tags from my category table in the modify template?
Aug 17, 2002, 8:07 PM
Veteran (1187 posts)
Aug 17, 2002, 8:07 PM
Post #2 of 14
Views: 3534
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
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
Aug 17, 2002, 8:34 PM
Veteran (1187 posts)
Aug 17, 2002, 8:34 PM
Post #4 of 14
Views: 3495
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
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
Aug 17, 2002, 9:40 PM
Veteran (1187 posts)
Aug 17, 2002, 9:40 PM
Post #6 of 14
Views: 3494
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
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
Aug 18, 2002, 1:55 AM
Veteran / Moderator (2199 posts)
Aug 18, 2002, 1:55 AM
Post #8 of 14
Views: 3467
Use this global (use as <%get_category_tags%>)
my $tags = shift;
return $DB->table('Category')->get($tags->{'CatLinks.CategoryID'});
}
Ivan
-----
Iyengar Yoga Resources / GT Plugins
Code:
sub { my $tags = shift;
return $DB->table('Category')->get($tags->{'CatLinks.CategoryID'});
}
Ivan
-----
Iyengar Yoga Resources / GT Plugins
Aug 24, 2002, 11:59 AM
Veteran / Moderator (2199 posts)
Aug 24, 2002, 11:59 AM
Post #10 of 14
Views: 3438
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_'.
my $tags = shift;
my $cat = $DB->table('Category')->get($tags->{'CatLinks.CategoryID'});
return { map { 'category_' . $_ => $cat->{$_} } keys %$cat };
}
Ivan
-----
Iyengar Yoga Resources / GT Plugins
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
Aug 24, 2002, 12:39 PM
Veteran / Moderator (2199 posts)
Aug 24, 2002, 12:39 PM
Post #12 of 14
Views: 3470
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
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
Aug 24, 2002, 1:01 PM
Veteran (19537 posts)
Aug 24, 2002, 1:01 PM
Post #13 of 14
Views: 3439
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:
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 }
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 }
Aug 24, 2002, 1:10 PM
Veteran / Moderator (2199 posts)
Aug 24, 2002, 1:10 PM
Post #14 of 14
Views: 3454
Paul, thanks for the explanation. I'll experiment with it.
Ivan
-----
Iyengar Yoga Resources / GT Plugins
Ivan
-----
Iyengar Yoga Resources / GT Plugins