Gossamer Forum
Quote Reply
tag global
Hi Andy,
I'm using this global to show tags on my page called from the title of the link.#
Do you know how I define a list of sign and letters to delete them from the results.
I want to delete signs like ?!"()
Cause at the moment in some cases I get tags like word_a? or word_b!

Code:
sub {
my $tags = GT::Template->tags;
my @words = split(/\s+/,$tags->{Title});
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);

}

Thanks

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] tag global In reply to
Hi,

If I'm understanding you right, you would change:

Code:
s/[\.,]$//sg;

..to:

Code:
s/[\.,\?!\(\)"]+$//sg;

Untested, but it 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] tag global In reply to
Cool, thanks Andy,
seems to work fine Smile
Thanks

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] tag global In reply to
Hi Andy,
I just saw that this bracket ( is still shown.
But ) is gone Blush
I'm also trying to hide -
Thanks

Matthias
gpaed.de

Last edited by:

Matthias70: Jan 17, 2012, 1:43 PM
Quote Reply
Re: [Matthias70] tag global In reply to
Did you want it to replace those charachters in the string, no matter where they are?

The following:

Code:
s/[\.,\?!\(\)"]+$//sg;

Will just remove them from the END of the string. If you wanna remove them from the whole string, try:

Code:
s/[\.,\?!\(\)"]+//sg;

(just remove the $)

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] tag global In reply to
Andy wrote:
Code:
s/[\.,\?!\(\)"]+//sg;

I will never understand all of this string-things, but it works ;-)
I just added
Code:
s/[\.,\?!\(\)\-"]+//sg;

to geht rid of the -
Is this right?
Thanks

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] tag global In reply to
Quote:
to geht rid of the -
Is this right?

Looks ok to me Angelic

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] tag global In reply to
Andy wrote:
Quote:
to geht rid of the -
Is this right?


Looks ok to me Angelic

And it seems to work fine for me Cool
Thanks

Matthias
gpaed.de