• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Template edits needed to insert banner ad code

#1
Hi guys.

I need someone to edit a few templates to add some banner ad code to display for guests only.

I can pay through Paypal.

Thanks.
 

Chris D

XenForo developer
Staff member
#2
Hi VtoX,

How about we do it another way...

I could easily instruct you in this thread how to do it. You then save a little bit of money and also, you might learn something for the future.

It's very easy so I wouldn't want to take money from you and I think it's a good thing to learn...
 
#3
Hi Chris.

Thank you. That is very kind of you to offer. If you feel it is easy enough and won't take up too much of your time I'd certainly appreciate the help.
 

Chris D

XenForo developer
Staff member
#4
Sure.

First of all, there's already a load of blank templates that you can insert banner ad code to.

This awesome post by Slavik shows the location of most of the ad templates:

http://xenforo.com/community/threads/any-list-of-ad-locations.17546/#post-229024

This shows you the location of the ad_templates and their names. Once you have worked out which locations you want to display ads, the following example is if you want to insert banner ad code into the ad_above_content template:
  1. Go to Admin CP
  2. Go to Appearance Tab
  3. Click Templates
  4. In the filter box type ad_above_content
  5. Click the template
  6. Paste in your ad code.
That will display the ads to all users. If you wanted to display it to guests only, it would look like this:
Code:
<xen:if is="!{$visitor.user_id}">
<Pasted ad code>​
</xen:if>
 
#8
Hey Chris.

I hate to bother you but I'd like to start adding the ad code to the templates like you instructed but I have a little road block.

I'd like to duplicate my current style and make changes to the duplicate style for testing, etc to make sure I have everything working before I go live with it. Then I figured I would rename the new style with the new ad code and go live with it once it's working fine and disable the existing style.

Is there an easy way to do this?

Thanks again for all your help.
 

Chris D

XenForo developer
Staff member
#9
Hey Chris.

I hate to bother you but I'd like to start adding the ad code to the templates like you instructed but I have a little road block.

I'd like to duplicate my current style and make changes to the duplicate style for testing, etc to make sure I have everything working before I go live with it. Then I figured I would rename the new style with the new ad code and go live with it once it's working fine and disable the existing style.

Is there an easy way to do this?

Thanks again for all your help.
If you go to:

Admin CP > Appearance > Styles > Create New Style

What you want to do is give it a name then under "Parent Style" select your existing style.

The new style will be identical to the original style. Make all the changes you need to make in the new style. If you make any mistakes in the new style, you can revert the changes for that template back to the original style. Then, when you're happy, you can delete the original style.
 
#13
Slowly getting there Chris but I have another question. I hate to ask but hopefully your assistance will be of help to others too.

I'm using an ad management network that loads all the ads asynchronously.

They provide little snippits of code to place where I want the ads to appear. My problem is that I do not know how to align the ads. I need to be able to left justify, center or right justify the ad.

The ad code looks like this:

Code:
<div id="bxk33402"></div>
I understand I place it into the template that I want it to appear but do you know I can modify the position and padding if necessary?


The ad management network also provides a script that must be placed inside the head tag. Where would that be.

Sorry to ask what must be such simple questions to you.

Thanks.
 
#14
I added the code however when someone views my site on a mobile device (iphone) the banner is too wide, and makes the forum look too narrow. If you go to www.cigarpass.com/forum you'll see what I mean. Any way to have the banner (image) resize correctly? It used to work on my old forum, so may be just a code insert I need? Thanks...
 
#16
My banner ad rotator is a custom php script (very small). It uses an iframe - is that a problem?
HTML:
<!-- ::: BANNER ADS ::: -->
<xen:if is="@enableResponsive">
<center>
<iframe src="http://www.domain.com/ad.php" width="475" height="65" frameBorder="no" scrolling="no" marginheight="5" hspace="5" vspace="5">
  <p>Your browser does not support iframes.</p>
</iframe>
</center><br>
</xen:if>
<!-- ::: BANNER ADS ::: -->