Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Show CategoryID in Add_Success.html?

Quote Reply
Show CategoryID in Add_Success.html?
Hi,

Anyone know how to show category ID in the add successful page?

add.html uses: CatLinks.CategoryID

after that:

I can't get back the category id?

Tried: <%category_id%> <%CategoryID%> ..all doesn't work :(

Last, What can I do to keep category id the same whether or not if the user modify he/her links?


Thanks for your help!

Last edited by:

mrcry11: Sep 29, 2002, 8:38 PM
Quote Reply
Re: [mrcry11] Show CategoryID in Add_Success.html? In reply to
Try <%ID%>.
Quote Reply
Re: [afinlr] Show CategoryID in Add_Success.html? In reply to
And if this doesn't work, try

<%GT::Template::dump%>

to see which tags are available.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [mrcry11] Show CategoryID in Add_Success.html? In reply to
<%ID%> would just show the link ID #

<%GT::Template::dump%> The catid was not shown on the dump but thanks anyways; i learned something useful. :)

I guess i have to create a int field in link called "catID" then in the add.cgi, change the backward compatibility so the categoryid would save to catID in links. Thats not what i prefer but o wells.



Thanks anyways.
Quote Reply
Re: [mrcry11] Show CategoryID in Add_Success.html? In reply to
Oops, I was looking at the add page instead of the add_success page.

The Category ID is on the add_success page but it is stuck inside an array. I think that to print this you need a global - maybe there is a way to do it using loops but I'm not sure. Anyway, this global seems to work:

sub {
my @catids = shift;
my $catid = pop @catids;
$catid = pop @$catid;
return $catid;
}

Name the global catid and then call it with <%catid($CatLinks.CategoryID)%>

Hope it works for you.

Laura.
The UK High Street
Quote Reply
Re: [mrcry11] Show CategoryID in Add_Success.html? In reply to
O my god! You the best Laura.
Quote Reply
Re: [afinlr] Show CategoryID in Add_Success.html? In reply to
Unless I've misunderstood what is going on I think there are a few problems with this global:

Code:
sub {
my @catids = shift;
my $catid = pop @catids;
$catid = pop @$catid;
return $catid;
}

my @catids = shift would only fill @catids with one element everytime as shift uses scalar context and an array is a list. You'd need:

my @catids = @_;

You are then grabbing the last element of @catids and storing it as $catid. Are all elements in @catids array references?....if not then:

$catid = pop @$catid will cause a fatal error.

If I've misunderstood then sorry Blush

Last edited by:

Paul: Sep 30, 2002, 5:05 PM
Quote Reply
Re: [Paul] Show CategoryID in Add_Success.html? In reply to
Hi Paul,

I wrote it and it worked so I stopped Wink.

Its too late here to think about this too hard. Unless some major mods have been done I don't think you can easily add a link to multiple categories, so this double array will only ever have one element. Please feel free to sort it out!

Laura.
The UK High Street
Quote Reply
Re: [afinlr] Show CategoryID in Add_Success.html? In reply to
This should do the trick as a global:

Code:
'cat_id' => 'sub { return $IN->param('CatLinks.CategoryID') }'

Then in the template just add the tag <%cat_id%>

Last edited by:

Paul: Sep 30, 2002, 5:26 PM
Quote Reply
Re: [Paul] Show CategoryID in Add_Success.html? In reply to
So easy when you know how!
Quote Reply
Re: [afinlr] Show CategoryID in Add_Success.html? In reply to
It is not tested but the only problem I can see is that it may not recognise the CGI object from the global, if not just add:

Code:
require Links;
import Links qw/$IN/;
Quote Reply
Re: [mrcry11] Show CategoryID in Add_Success.html? In reply to
Could that possibly work for the emails as well? I mean show the category in emails? I'm trying to find a solution to that:

http://www.gossamer-threads.com/...;;page=unread#unread

And I can't afford the $125 needed to fix this by the support team Crazy

If you love cats - visit www.TheCatSite.com

Visit my LinkSQL based Cat Site - www.Meowhoo.com
Quote Reply
Re: [Anat] Show CategoryID in Add_Success.html? In reply to
This is the code I used:

sub {
require Links; import Links qw/$IN/;
return $IN->param('CatLinks.CategoryID')
}

The previous versions gave back in the email something that looked like <%cat_id%> This version just gives a blank output Unimpressed


If you love cats - visit www.TheCatSite.com

Visit my LinkSQL based Cat Site - www.Meowhoo.com
Quote Reply
Re: [Anat] Show CategoryID in Add_Success.html? In reply to
oops - I just realized we're talking about two different things.

I'm trying to get the category full name in the mass emailer.

If anyone knows how to acheive that - I'd be most grateful.

If you love cats - visit www.TheCatSite.com

Visit my LinkSQL based Cat Site - www.Meowhoo.com
Quote Reply
Re: [Anat] Show CategoryID in Add_Success.html? In reply to
Hi,

Try this global:

sub {
my ($rec) = @_;
my $id = $rec->{ID};
my $db = $DB->table ('Category','CatLinks');
my $sth = $db->select ( { 'CatLinks.LinkID' => $id }, ['Category.Full_Name'] );
my $output;
while (my $cat = $sth->fetchrow_array){
$output.= qq~<li>$cat~;
}
return $output;
}


I'm assuming that the id of the link is available as a tag in the template.

Hope it works,

Laura.
Edit: I just added a fix for multiple categories.
The UK High Street

Last edited by:

afinlr: Oct 2, 2002, 4:18 PM
Quote Reply
Re: [afinlr] Show CategoryID in Add_Success.html? In reply to
Thank You!!!

Thank You!!!

Thank You!!!

If you love cats - visit www.TheCatSite.com

Visit my LinkSQL based Cat Site - www.Meowhoo.com