Gossamer Forum
Quote Reply
phpAdsNew and keywords
I've started to use phpAdsNew to serve some banner ads on my site. So far I have managed to get keyword targeted banners working okay in search_results.html, using the <%query%> tag in the ad serving code.

Key phrase searches are not working very well though. Searching 'keyword 1 keyword 2' (without the quotes) only pulls up the banner if the two keywords are both defined and adjacent in the banner config in phpAdsNew.

Does anyone know if it's possible to parse the search query into separate search words, and then have them able to be included as tags? I would imagine you would need to limit it to say 5 terms and then fill each one in turn.
Quote Reply
Re: [aus_dave] phpAdsNew and keywords In reply to
After some more testing I think the easiest method will be to create a global that takes the <%query%> or <%term%> tags from the search_results file and returns them as another tag containing a comma separated list of keywords.

Essentially I need to do a find and replace on the %20 character (space) in <%term%>. Does anyone have any suggestions on how this could be done?
Quote Reply
Re: [aus_dave] phpAdsNew and keywords In reply to
dunno if this will work but anyway:

sub

{

my $text = shift;

$text =~ s/ /,/ig;

return $text;

}
Quote Reply
Re: [kzap] phpAdsNew and keywords In reply to
Thanks kzap, I found some similar code in another post and ended up using this:

Code:
sub {
my $tags = shift;
my $query = $IN->param('query');
my @words = split /\s+/, $query;
my $keywords = join (",", @words);
return $keywords;
}


I don't know Perl though so I'm sure that is not textbook perfect Wink.
Quote Reply
Re: [aus_dave] phpAdsNew and keywords In reply to
Yeah, thats fine. It will simply join the query with commas between the spaces, and return it as a tag for you.

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!