Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Single categoryname (tag) and parse a category into a google search string...

Quote Reply
Single categoryname (tag) and parse a category into a google search string...
Hi,

I have 2 questions:
1)

I have want to have a category tag without the whole path.

<%title%>
<%title_linked%>
<%category_name%>

these tags gives the whole path:
ex:
d/dogs or c/cats. But I want only dogs or cats.

2)
How can I parse the categoryname in a searchstring for google on the category page?. This is more tricky and I hope that someone can help me.

Ex:

I have a category with artists with lyrics alphabetically.

a|b|c|d| > on the home page

when we go into the A subpage than we have:
ABBA
ALANIS MORISSETTE etc.. and when we go in abba we get the lyrics. still simple ;-)

But beneath ABBA etc.. I want something like: find more ABBA with Google or find more ALANIS MORISSETTE with Google like:

ABBA
find more abba with google
ALANIS MORISSETTE
find more alanis morissette with Google

I want to parse the categoryname in the Google search string => www.google.com/search?q=<%MY_MISSING_CATEGORY_TAG%> and this must be the output.
www.google.com/search?q=abba

So the difficult part for me is: how can I put this info beneath the category and what <%TAG%> must be used?

Thanks,
Ron...
Quote Reply
Re: [rsahertian] Single categoryname (tag) and parse a category into a google search string... In reply to
You should be able to use this global on category pages if you have the <%ID%> tag available:

sub {
my $tags = shift;
my $id = $tags->{'ID'};
return $DB->table ('Category')->select ( { ID => $id }, ['Name'] )->fetchrow_array;
}
Quote Reply
Re: [afinlr] Single categoryname (tag) and parse a category into a google search string... In reply to
thanks Laura,

Gonna try some things now....

Smile
Quote Reply
Re: [rsahertian] Single categoryname (tag) and parse a category into a google search string... In reply to
Laura,

Can you tell me how your global will be active when FatherID NOT equals 0 ?

Otherwise it shows the a, b, c, etc...

thanks,
ron
Quote Reply
Re: [rsahertian] Single categoryname (tag) and parse a category into a google search string... In reply to
What about this:

sub {
my $tags = shift;
my $id = $tags->{'ID'};
my $cond = GT::SQL::Condition->new( 'ID', '=', $id, 'FatherID', '>', '0');
return $DB->table ('Category')->select ( $cond, ['Name'] )->fetchrow_array;
}
Quote Reply
Re: [afinlr] Single categoryname (tag) and parse a category into a google search string... In reply to
Great Laura......

Can I use this global in the description field?? It's a perfect place for my google search string....

thanks,
ron
Quote Reply
Re: [rsahertian] Single categoryname (tag) and parse a category into a google search string... In reply to
Can't you just put it above/below the Description tag? Just as you have in the post above.
Quote Reply
Re: [afinlr] Single categoryname (tag) and parse a category into a google search string... In reply to
No sorry Laura.. I want to use that <%tag%> in the description field of a category.

is that possible???

thanks
ron
Quote Reply
Re: [rsahertian] Single categoryname (tag) and parse a category into a google search string... In reply to
Unfortunately not - you can't put tags into the database. Can you describe a bit more exactly what you want because you could possibly parse the description field with another global.
Quote Reply
Re: [afinlr] Single categoryname (tag) and parse a category into a google search string... In reply to
Laura,

When you put something in the description field of a category, the categorypages will show up like this. (I don't have really links, but I have a lyrics archive)

ABBA
here comes the description
ALANIS MORISSETTE
here comes the description

But I want to use the descriptionfield as a searchpossibility with Google.

So if I can get that catname back (with your global) in the description field, then I can use this in the descriptionfield:
www.google.com/search?q=<%tag_with_catname%>

I will be shown to people like:

ABBA
more ABBA by google <= hyperlink from www.google.com/search?q=<%tag_with_catname%>


thanks,
Ron
Quote Reply
Re: [rsahertian] Single categoryname (tag) and parse a category into a google search string... In reply to
So you don't actually need the description tag there at all?
You could just use:

more <%globalname%> by <a href="www.google.com/search?q=<%globalname%>">google</a>
Quote Reply
Re: [afinlr] Single categoryname (tag) and parse a category into a google search string... In reply to
Yes Laura...

It's ok now, I forgot the subcategory.html template. It's now okay with your global....

many thanks.....
Ron
Quote Reply
Re: [afinlr] Single categoryname (tag) and parse a category into a google search string... In reply to
Hi Laura,

How can I fix that:
more <%globalname%> by <a href="www.google.com/search?q=<%globalname%>">google</a>
doesn't show up when FatherID = 0 ?

thanks,
Ron
Quote Reply
Re: [rsahertian] Single categoryname (tag) and parse a category into a google search string... In reply to
I think FatherID is available as a tag so you could try

<%unless FatherID == 0%>more <%globalname%> by <a href="www.google.com/search?q=<%globalname%>">google</a><%endunless%>
Quote Reply
Re: [afinlr] Single categoryname (tag) and parse a category into a google search string... In reply to
GREAT LAURA !!!!!
THANKS !!!!!!
Quote Reply
Re: [rsahertian] Single categoryname (tag) and parse a category into a google search string... In reply to
I placed into global
sub {
my $tags = shift;
my $id = $tags->{'ID'};
my $cond = GT::SQL::Condition->new( 'ID', '=', $id, 'FatherID', '>', '0');
return $DB->table ('Category')->select ( $cond, ['Name'] )->fetchrow_array;
}

but it only give me a numerical value how can i have it display the category name?