[SOLVED] Category specific banner ad targeting (story.php / story_center.tpl)

Register an Account
Pligg Chat Room
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-07-2009, 03:13 PM
Donor
Donation Level 2 
 
Join Date: Jul 2008
Posts: 25
I've searched the forums, tried a whole bunch of little hacks, but I have yet to find a solution for the idea I want to implement.

I'm not much of a coder, so I thought maybe someone from the forum could help. Here's an example of what I want to do.

Category 1 - Birds
Category 2 - Cats
Category 3 - Dogs

Let's say I have a site with categories on many different types of pets. I don't, but maybe that's a good idea? Who knows! Anyway, when a person clicks on a story from the Birds category, say "Bird attacks owner with tiny machete", I want a bird-specific ad to show up on the story page.

It would look like this.

Story

Bird Food Ad

Comments


Now, let's say the person surfed over to the story "Cat saves local fireman from tree", which is in the Cats category. Now I want a cat specific banner ad to pop up.

I know I could throw an adsense block right there and I know where to put it in story_center.tpl, so the location is not an issue. I'm more interested in targeting some affiliate programs with this idea.

I've tried writing some conditional {if} statements in story_center.tpl after {$the_story}, but I'm having no luck with getting any category variables to play along with my ruse.

For example:

{if $category_id eq '1' }
ad code
{/if}

Did not produce the desired result. I've tried $category_name, $category_safe_name, $link_category_id, and a few others.

Hopefully, someone understood my meager dream of targeted ads and will come to my rescue.

Thanks!
Reply With Quote
  #2 (permalink)  
Old 01-07-2009, 03:38 PM
chuckroast's Avatar
Pligg Developer/Coder/Designer
Pligg Version: SVN
Pligg Template: Galleria
 
Join Date: Jun 2006
Posts: 3,832
I haven't tried this and have no idea if this would work but I would try something this in link_summary.tpl

Code:
{if $pagename eq "story"}
{if $cat_array[thecat].dogs}
<----Advertisement about dogs----->
{/if}{/if}

{if $pagename eq "story"}
{if $cat_array[thecat].birds}
<---Advertisement about birds------>
{/if}{/if}

and so on...


Download the full Pligg Module Pack





Reply With Quote
  #3 (permalink)  
Old 01-07-2009, 03:55 PM
Yankidank's Avatar
Pligg Founder/Coder/Designer
Pligg Version: SVN
Pligg Template: Wistie
 
Join Date: Dec 2005
Location: Ocala, FL
Posts: 3,803
Send a message via AIM to Yankidank Send a message via Skype™ to Yankidank
I'm not familiar with Chucks method, but I wrote up working code for 1.0 in the wiki a week ago:
Pligg Categories

Now Available: Facebook Connect Module !
Reply With Quote
  #4 (permalink)  
Old 01-07-2009, 04:52 PM
chuckroast's Avatar
Pligg Developer/Coder/Designer
Pligg Version: SVN
Pligg Template: Galleria
 
Join Date: Jun 2006
Posts: 3,832
Yeah, you can probably also do it like

{if $pagename eq "story"}
{if $request_category eq "dogs"}
<----Advertisement about dogs----->
{/if}{/if}

{if $pagename eq "story"}
{if $request_category eq "birds"}
<---Advertisement about birds------>
{/if}{/if}

and so on...


Download the full Pligg Module Pack





Reply With Quote
  #5 (permalink)  
Old 01-07-2009, 06:53 PM
Donor
 
Join Date: Jul 2008
Posts: 25
I tried both of those methods but they didn't work. I tried the code (both variations) in link_summary and story_center, but so far no combination has produced the desired result. I tried double quotes and single quotes around the category name and I tried using the category_safe_name, but no luck.

Can you give me a specific idea of where to place the code? I will gladly make a donation to the pligg cause if you can help me with this trick!

Thanks!
Reply With Quote
  #6 (permalink)  
Old 01-07-2009, 07:12 PM
chuckroast's Avatar
Pligg Developer/Coder/Designer
Pligg Version: SVN
Pligg Template: Galleria
 
Join Date: Jun 2006
Posts: 3,832
I just tried this on my site and it works. Using category ID numbers. Lets say the category dogs has the Id number of 2

{if $pagename eq "story"}
{if $category_id eq "2"}
<----Advertisement about dogs----->
{/if}{/if}

Repete for each category.

Then put the code in link_summary.tpl just above
{checkActionsTpl location="tpl_link_summary_end"}

Good Luck


Download the full Pligg Module Pack





Reply With Quote
  #7 (permalink)  
Old 01-07-2009, 10:13 PM
Donor
 
Join Date: Jul 2008
Posts: 25
Quote:
Originally Posted by chuckroast View Post
I just tried this on my site and it works. Using category ID numbers. Lets say the category dogs has the Id number of 2

{if $pagename eq "story"}
{if $category_id eq "2"}
<----Advertisement about dogs----->
{/if}{/if}

Repete for each category.

Then put the code in link_summary.tpl just above
{checkActionsTpl location="tpl_link_summary_end"}

Good Luck
Perfect! This is exactly what I needed. You can go ahead and do a [SOLVED] on this one.
Reply With Quote
  #8 (permalink)  
Old 12-26-2009, 05:37 PM
lowster11's Avatar
Pligg Donor/Designer
Pligg Version: 1.0.3
Pligg Template: custom
Donation Level 1 
 
Join Date: Oct 2009
Location: Sacramento
Posts: 227
DrewryNewsNetwork - go spam your own site!!!!
Reply With Quote
  #9 (permalink)  
Old 12-26-2009, 05:56 PM
lowster11's Avatar
Pligg Donor/Designer
Pligg Version: 1.0.3
Pligg Template: custom
 
Join Date: Oct 2009
Location: Sacramento
Posts: 227
did you fart? lol...j/k

I am referring to your fake sig link that you are using in your posts!
Reply With Quote
  #10 (permalink)  
Old 12-26-2009, 07:23 PM
chuckroast's Avatar
Pligg Developer/Coder/Designer
Pligg Version: SVN
Pligg Template: Galleria
 
Join Date: Jun 2006
Posts: 3,832
Quote:
Originally Posted by DrewryNewsNetwork View Post
That is not a fake signature. That was placed in there, thank you sir. Enjoy your day and I wish you the best of success and prosperity in 2010 =)

This is absolutely a fake signature. You don't have enough confirmed posts to be allowed to have a signature.
The user will be banned the next time it's added.


Download the full Pligg Module Pack





Reply With Quote
Reply

Tags
ads, affiliate, category, specific

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Control of meta description - categories Divisive Cotton Questions and Comments 65 11-06-2009 07:10 PM
Pligg Categories Yankidank Wiki Articles 1 12-17-2008 10:10 AM
[SOLVED] Upcoming Specific Category RSS Feeds blaze Questions and Comments 2 09-23-2008 09:10 AM
[SOLVED] Category order does not match Category Management page grey580 Questions and Comments 7 09-09-2008 01:31 PM
[SOLVED] Bug in story.php with category URL ablaye Questions and Comments 1 01-18-2008 07:11 PM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development