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

clean sentence from Title

Quote Reply
clean sentence from Title
How can I clean from the Title a sentence like "aaa bbb ccc"
So if I have title like "aaa bbb ccc ddd eee fff"
I will get
"ddd eee fff"
and it will delete just if in the Title there is sentence exactly like the sentence.
So if I have "bbb ccc ddd eee fff" it will not delete noting.
Quote Reply
Re: [nir] clean sentence from Title In reply to
Something like this should work:

clean_the_title
Code:
sub {
my $to_clean = qq|aaa bbb ccc|;
my $tmp = $_[0];
$tmp =~ s/\Q$to_clean//g;
return $tmp;
}

..and call with:

<%clean_the_title($Title)%>

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] clean sentence from Title In reply to
Thanks,
It's not change the title at allWhistle
Quote Reply
Re: [nir] clean sentence from Title In reply to
How are you calling the global?

Also, what does the global look like now (I'm assuming its not just aaa bbb =))

..oh, and what does <%Title%> look like normally?

Cneers

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] clean sentence from Title In reply to
I call the global like you wroth

And this is the global

sub { my $to_clean = qq|I change this|; my $tmp = $_[0]; $tmp =~ s/\Q$to_clean//g; return $tmp; }
Thanks
Quote Reply
Re: [nir] clean sentence from Title In reply to
Mmm, that should work fine :/

The only thing I can think of - is maybe its a different "case" (i.e some capitals)

Try:

Code:
$tmp =~ s/\Q$to_clean//gi;

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] clean sentence from Title In reply to
work:)
Thanks
Quote Reply
Re: [nir] clean sentence from Title In reply to
Cool Cool

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!