Gossamer Forum
Home : Products : Links 2.0 : Customization :

Category tag for dynamic advertising

Quote Reply
Category tag for dynamic advertising
Hello,

We are trying to run some dynamic advertising that will return products based on the category name the user is browsing. I have almost got it to work, but have run into a problem..

In the URL provided by our advertiser their is a keyword= section and I want to insert the name of the subcategory being browsed. What I have at the moment is:

......&banner_size=300x250&form_keyword=<%category_name%>&banner_topc.....

but this returns:

.......&banner_size=300x250&form_keyword=Applications/Email&banner_topc...... when I am at: http://www.techtutorials.net/Applications/Email/.

What tag can I use instead of category_name that would just return "Email" in this case instead of "Applications/Email"?

Thanks for your help!!
Jason

Last edited by:

jsprague: Aug 28, 2007, 8:36 PM
Quote Reply
Re: [jsprague] Category tag for dynamic advertising In reply to
Add this subroutine to nph-build.cgi:

Code:
sub build_last_cat {
# --------------------------------------------------------
# Returns the last cat from a string of the current category


my $input = shift;
my (@dirs, $dir, $output, $path, $last);

@dirs = split (/\//, $input);
$last = &build_clean(pop @dirs);

$output = qq|$last|;

return $output;
}


In the same file, put this in sub_build_category_pages:

Code:
close FOOT;
}
$title_linked = &build_linked_title
($cat);
$last_cat =&build_last_cat ($cat);
$title = &build_unlinked_title ($cat);
$total = ($#{$links{$cat}} + 1) / ($#db_cols + 1);
$category_name = $cat;

Put this in site_html_templates.pl, sub site_html_category:

Code:
last_cat => $last_cat,

Now change your template code for the ad link to use the tag ...keywords=<%last_cat%>


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Category tag for dynamic advertising In reply to
I found some clearer instructions from a few years ago...
http://www.gossamer-threads.com/...?post=274925#p274925


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Category tag for dynamic advertising In reply to
Wow... Thanks for the awesome help.. That looks like exactly what I need!

Guess I need to work on my searching skills.. I searched the forum for an hour and never found that old post.. :)