68 Classifieds Forums
Go Back   68 Classifieds Forums > v3.1.x Help & Support > v3.1 Questions & Support > Target Banners to Category
v3.1 Questions & Support Help and support for 68 Classifieds v3.1.x

 
Thread Tools Display Modes
(#1)
Old
dawnrae dawnrae is offline
Junior Member
dawnrae is on a distinguished road
 
Posts: 17
Join Date: Jan 2007
Default Target Banners to Category - 02-16-2007, 03:53 PM

Hey, gang!

Here's my doofus question for the day ...
We're using an install of Adspro to provide banner ad management on our site. I am using .js includes for the banner campaigns, but I'd like to be able to target a specific .js banner campaign to a specific category. Here's the code I've come up with so far, but something is off:

{if $smarty.get.type == 0}
{php} include('http://www.hotspringshomefront.com/templates/mwt/banners/main-top-left.js'); {/php}
{else $smarty.get.sec == 20}
{php} include('http://www.hotspringshomefront.com/templates/mwt/banners/main-top-right.js'); {/php}
{/if}

I attempted to target the "else" include to the type, but it came up in all the categories, so I attempted the sec variable since it is the unique identifier in the url for the category, but it still comes up on all category pages. Any ideas?

Dawn
Reply With Quote
(#2)
Old
suzkaw suzkaw is offline
Help you, I will.
suzkaw has a spectacular aura about
 
Posts: 1,696
Join Date: Mar 2006
Location: Belmont, NC
Default 02-16-2007, 03:55 PM

I think it should be:
Code:
{if $smarty.get.type == 0} {php} include('http://www.hotspringshomefront.com/templates/mwt/banners/main-top-left.js'); {/php} {elseif $smarty.get.sec == 20} {php} include('http://www.hotspringshomefront.com/templates/mwt/banners/main-top-right.js'); {/php} {/if}


--
Thanks,
Eric Barnes
68 Classifieds
Documentation - Modifications - My Blog

Reply With Quote
(#3)
Old
dawnrae dawnrae is offline
Junior Member
dawnrae is on a distinguished road
 
Posts: 17
Join Date: Jan 2007
Default 02-16-2007, 03:58 PM

Cool, Eric, that targeted it right where I wanted it, but now, all the other categories have a blank spot there.
Should I use something other than the "0" in the initial if statement?

Dawn
Reply With Quote
(#4)
Old
suzkaw suzkaw is offline
Help you, I will.
suzkaw has a spectacular aura about
 
Posts: 1,696
Join Date: Mar 2006
Location: Belmont, NC
Default 02-16-2007, 04:05 PM

Can you post a link to the page you are wanting to add this? Also do you want the first if to show on every category?


--
Thanks,
Eric Barnes
68 Classifieds
Documentation - Modifications - My Blog

Reply With Quote
(#5)
Old
dawnrae dawnrae is offline
Junior Member
dawnrae is on a distinguished road
 
Posts: 17
Join Date: Jan 2007
Default 02-16-2007, 04:09 PM

Sure thing.

http://www.hotspringshomefront.com

What I want to do is have like a default campaign that shows up on all the pages unless someone decides to purchase a banner to display in a specific category.

So the first statement should address all categories of the site, displaying the default campaign, whereas the elseif statement will display any exceptions.

Dawn
Reply With Quote
(#6)
Old
suzkaw suzkaw is offline
Help you, I will.
suzkaw has a spectacular aura about
 
Posts: 1,696
Join Date: Mar 2006
Location: Belmont, NC
Default 02-16-2007, 04:47 PM

Ok lets try this.

Lets say someone purchased an advertisement for this category:
http://www.hotspringshomefront.com/category.php?type=20
and this one:
http://www.hotspringshomefront.com/c...?type=9&sec=11
Code:
{if $smarty.get.type=="20"} display sponsored ad here. {elseif $smarty.get.type=="9" && $smarty.get.sec=="11"} display sponsored another ad here. {else} display default banner ad here {/if}


--
Thanks,
Eric Barnes
68 Classifieds
Documentation - Modifications - My Blog

Reply With Quote
(#7)
Old
dawnrae dawnrae is offline
Junior Member
dawnrae is on a distinguished road
 
Posts: 17
Join Date: Jan 2007
Default 02-16-2007, 04:49 PM

Awesome, Eric! That worked great!
For your help, thank you so much! Hmmm!


Dawn
Reply With Quote
(#8)
Old
Mike-N-Tosh Mike-N-Tosh is online now
Member
Mike-N-Tosh will become famous soon enough
 
Posts: 38
Join Date: Jan 2007
Default Am I understanding this correctly? - 02-19-2007, 09:26 AM

I would like to do this exact same thing as well, but I'm using PHPadsnew. I just want to see if I'm understanding the logic in how this solution is being done.

Store the invocation code for displaying the ad in a folder on your site. (In your case the text files are here: http://www.hotspringshomefront.com/t...s/mwt/banners/)

The smarty code listed in this thread is stored in a php file located in the (68classifieds site/includes/classes/smarty/plugins/"myads.php")

Then you include a call to the smarty function within the layout.tpl.php file where you have designated your ad to be placed.

Is that correct, or am I missing something?

Thanks,
-Mike


Mike-N-Tosh
v3.1.5 Developer
Reply With Quote
(#9)
Old
Lhotch's Avatar
Lhotch Lhotch is offline
Moderator
Lhotch has a spectacular aura about
 
Posts: 1,447
Join Date: Mar 2006
Default 02-19-2007, 09:59 AM

Mike, you could make it a plugin and/or store the JS invocation code in seperate files, it really depends on just how many different invocation codes you want to use.

If your just going to have a couple then you can put them both and smarty code to determine which to use in layout.tpl.php.

If you have a lot of phpadsnew campaigns however it may be cleaner to move the js invocation to their own JS files and then create a plugin. Pass the category info to the plugin and have the php in the plugin call the appropriate JS invocation code and display that in the layout.tpl.php template.
Reply With Quote
(#10)
Old
Maffo Maffo is offline
Senior Member
Maffo is on a distinguished road
 
Posts: 527
Join Date: Mar 2006
Location: English in Argentina
Send a message via MSN to Maffo
Default 02-19-2007, 12:24 PM

Never being one to miss a plug but this is exactly what I developed my banner system for. It is dynamic across all pages including all of your categories. Customers can purchase ads, renew ads, etc.
Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Display Banner in one Category BABBSELA v3.1 Questions & Support 3 02-10-2007 03:22 PM
Branding each Category BABBSELA v3.1 Modifications 0 02-10-2007 02:17 PM
Adding 'category' to 'new listings' display Chaslie v3.1 Modifications 4 10-28-2006 09:58 PM
Category problem dawyatt v3.1 Questions & Support 2 05-24-2006 04:58 PM
Category fields in view list Lagniappe v3.0 Questions & Support 2 04-19-2006 10:09 AM



Powered by vBulletin® Version 3.6.3
Copyright ©2000 - 2007, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com