No announcement yet.

Adsense in first post of every thread page

  • Filter
  • Time
  • Show
Clear All
new posts

  • Adsense in first post of every thread page

    Hello. I'm searching for the variable that can provide me with the page number of the thread... or... a better method to add AdSense to every 1st posts in every thread page.

    I have this:

    <if condition="$post[postcount] ==1">
    but this works great in the first post... if i go to the second page of the thread the AdSense is obviously not there. How can I solve this?


  • #2
    The first post is the first post,
    the post on the second page is not the first post.

    I do not know how to show it on each first visible post on a thread page, regardless which thread PAge


    • #3
      For example if I can get in a variable the page number I can make the calculation like the page#-1 * posts per page +1 or something. That can give me the post number for every 1st post in a thread page.

      Is there a variable in $thread or $post that shows the page number? I mean is there any way to get this without hacking the showthread.php?



      • #4
        I don't know if page is a variable or not, but if it is, you can calculate what will be the first post based on your perpage value. But if you change THAT, you have to remember to change the template too. (which will be easy to remember because you'll notice the ad's in the wrong place).

        Let's make it simple, if you have 20 posts per page, you can stick in the template something like
        <if condition="$post[postcount] MOD 20"> and every 20th post will have your ad in it. Which will be first post on every page.
        WARNING, not tested.