MyBB Community Forums

Full Version: [NEW PUZZLE] Hardcode Adsense code into post #1 and post #3
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
The first part of the query was solved, but there is a problem.
I want ads to display on page 2, 3 etc too. If I got for the code which checks post number, then the ads display only on page 1!

Quote:First off, I dont want a recommendation for a plugin. I've tried one and it used to repeat the same Adsense code on all posts

I would like to know how to modify templates (and which ones), to add manually Adsense <script> </script> codes specifically into posts #1 and #3 only. I need the codes to be seperate. Ideally I'd prefer using the Conditionals plugin to see whether the post number is #1, and if so, it displays Adcode1, if it is post #3, then Adcode2.

Which template should I modify, and how do I check the condition with a conditional operator?
You can't do this without a plugin. Not sure which one you used but obviously it's either a bad plugin or you didn't correctly set it up.
Why cant I do this without a plugin? There is a template which formats pages, right? I do have the MyBB conditionals plugin. I was hoping to use it within the template to calculate the post number. I have previously modified postbit_classic to see if the user is admin, and if so to display user title in a strong font. There I used IF conditional for getting the group ID. I was hoping to do something similiar
Using the template conditionals plugin, as you mentioned, it is like this (I think so):
<if $postcounter == '1' then>
//add code here will be show after post one
</if>
<if $postcounter == '3' then>
//add code here will be show after third post
</if>
Quote: I do have the MyBB conditionals plugin.

Sure but that's a plugin. You said...

Quote:First off, I dont want a recommendation for a plugin.

(2011-11-19, 07:10 AM)labrocca Wrote: [ -> ]
Quote: I do have the MyBB conditionals plugin.

Sure but that's a plugin. You said...

Quote:First off, I dont want a recommendation for a plugin.

Sorry for writing two mutually contradictory statements. What I should have said was that I didnt want to use a plugin meant for displaying ads in posts, but that I wanted to use the conditional plugin or code to format the code for Adsense in a way that I want.

I suppose I can add a Table row in postbit_classic to display the ad according to the conditional code/
I'm using this kind of plugin, from Joey P Smile
(2011-11-19, 07:41 AM)phwebmaster.net Wrote: [ -> ]I'm using this kind of plugin, from Joey P Smile

It allows you to use three different Ad sense codes for three different posts? Could you post a link if it can do that?
Aw nope..
It displays ads in custom interval post, like every 3 interval..

Try Yaldaram's plugin.
(2011-11-19, 07:53 AM)phwebmaster.net Wrote: [ -> ]Aw nope..
It displays ads in custom interval post, like every 3 interval..

Try Yaldaram's plugin.

Ah yes, I had tried that one then. If the same Google Adsense code is displayed on two different posts, then it counts as only 1 page view. So that means that even though we're disturbing our users with too many ads, it doesnt give us any additional revenue. Smile

I think Yaldaram's method is being used to insert ads into my header and footer. Does he have a plugin that does the functions I need, namely different ads into different posts?
Pages: 1 2