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

global - search for title tags

Quote Reply
global - search for title tags
Hi,
don't know if it's possible, but how about a global that
prints out all words (longer than 3 letters) of a link title linking to the search results of this word.

For example:
Link title: Wallpapers, Photos and Files

global output should something like this on detailpage

Find other similiar Links:
Wallpapers - Photos - Files


each word should be linked to the search page (notice that "and" is not printed)

Thanks

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] global - search for title tags In reply to
Hi,

somethink like below should work:


Cheers,

Code:
sub {


my $tags = GT::Template->tags;
my @words = split(/\s+/,$tags->{Title});
my @links = ();
foreach (@words){
s/^\s*//sg;
s/[\.,]$//sg;
my $w=$_;
next if length($w)<4;

push(@links,qq|<a href="$CFG->{db_cgi_url}/search.cgi?query=$w">$w</a>|);
}

return join(" - ",@links);

}

Cheers,

Dat

Programming and creating plugins and templates
Blog
Quote Reply
Re: [tandat] global - search for title tags In reply to
Hi,

Just wondering, why you are doing $w=$_ ?

Code:
sub {
my @words = split(/\s+/,$_[0]);
my @links;

foreach (@words){
s/^\s*//sg;
s/[\.,]$//sg;
next if length($_)<4;
push(@links,qq|<a href="$CFG->{db_cgi_url}/search.cgi?query=$_">$_</a>|);
}

return join(" - ",@links);

}

Just cuts out one line <G>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

Andy: May 28, 2008, 9:27 AM
Quote Reply
Re: [Andy] global - search for title tags In reply to
Hi Andy,

The reason is that I know you will make it changes ;-)

Cheers,

Dat

Programming and creating plugins and templates
Blog
Quote Reply
Re: [Andy] global - search for title tags In reply to
Hi Andy and Tandat,
great teamwork, the globals works like a charm.

Thanks a lot

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] global - search for title tags In reply to
Nice Global, but how do you get it to display on the search results page?
Quote Reply
Re: [rascal] global - search for title tags In reply to
Hi

Cos he's using $tags, you should be able to just call it with:

<%global_name%>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] global - search for title tags In reply to
Cool global...

What about if I want to place it in the search results templete? Nothing shows up.
Quote Reply
Re: [Gorospe] global - search for title tags In reply to
Try the modified version here (just made a change);

http://www.gossamer-threads.com/...?post=302262#p302262

Then, call with:

Code:
<%global_name($Field_To_Work_On)%>

i.e:
Code:
<%global_name($Title)%>

That should work.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] global - search for title tags In reply to
Hmmm its not working. Doesnt give an error either.

Ideas?

It works in the detailed templete, but not in search_results.html templete

Last edited by:

Gorospe: May 28, 2008, 12:01 PM
Quote Reply
Re: [Gorospe] global - search for title tags In reply to
..and your calling it with?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] global - search for title tags In reply to
<%search_tags($Title)%>
Quote Reply
Re: [Gorospe] global - search for title tags In reply to
Hi,

PM or email over Glinks admin details, and I'll take a look for you. Should work fine.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] global - search for title tags In reply to
Hi Andy,

Does not work on search_results, did you figure out why?
Quote Reply
Re: [rascal] global - search for title tags In reply to
Hi,

You need to use the $query tag, if actually using it in search_results.html.

Try this global:


Code:
sub {
my @words = split(/\s+/,$_[0]);
my @links;

foreach (@words){
s/^\s*//sg;
s/[\.,]$//sg;
next if length($_)<4;
push(@links,qq|<a href="$CFG->{db_cgi_url}/search.cgi?query=$_">$_</a>|);
}

return join(" - ",@links);

}

..and call with:

<%global_name($query)%>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] global - search for title tags In reply to
Thanks Andy,

It works now!