forum ad code - help !

Discussion in 'Programming' started by adminworld, Jul 20, 2012.

  1. #1
    Hey programmers,

    I need some help. I have phpbb3 subsilver2 and i want to add adsesnse to post BUT i only want to show in the first two.

    Right now when i added the code it does show 2 (because i have one in the header) but on the 3rd i see a big space where the add should be.

    I tried to limit the ads with this code

    <?php if ($i <2) { ?>
    (ad in here)
    <?php } ?>

    but it didnt work. (It does work on my blog tho)

    So can someone help me? Thanks
     
    adminworld, Jul 20, 2012 IP
  2. adminworld

    adminworld Well-Known Member

    Messages:
    287
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    130
    #2
    Can someone help me here ? Thanks
     
    adminworld, Jul 20, 2012 IP
  3. mnmani

    mnmani Well-Known Member

    Messages:
    379
    Likes Received:
    11
    Best Answers:
    6
    Trophy Points:
    195
    #3
    $i has no value - it does not work on phpBB forums !!
     
    mnmani, Jul 21, 2012 IP
  4. MilesB

    MilesB Well-Known Member

    Messages:
    1,813
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    180
    #4
    instead of this in your first line of new code:
    if($i == 1)
    
    Code (markup):
    use:
    if($i == 1 && $user->data['user_id'] == ANONYMOUS)
    Code (markup):
     
    MilesB, Jul 22, 2012 IP
  5. adminworld

    adminworld Well-Known Member

    Messages:
    287
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    130
    #5
    MilesB, it didnt work but maybe i did something wrong ? Any more ideas ? Thanks
     
    adminworld, Jul 22, 2012 IP
  6. mnmani

    mnmani Well-Known Member

    Messages:
    379
    Likes Received:
    11
    Best Answers:
    6
    Trophy Points:
    195
    #6
    well, php code in phpBB templates works only on a few styles. regular styles do not have that feature ..

    it is better to use suggested methods here : advertisements in phpbb3
     
    mnmani, Jul 22, 2012 IP
  7. thomson3241

    thomson3241 Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    if your using mybb , go to the admin panel then go to templates , then global i think , then find header , places a banner there , then create a new banner then go to footer and put a there banner in there.


    If you need help personally ill do it for $10
     
    thomson3241, Jul 22, 2012 IP
  8. mnmani

    mnmani Well-Known Member

    Messages:
    379
    Likes Received:
    11
    Best Answers:
    6
    Trophy Points:
    195
    #8
    ^ hmm., even if it is MyBB, no such banner feature exists there !! And the required work, if it can be done, is worth of 5$ ; OP is offering 2$
     
    mnmani, Jul 22, 2012 IP
  9. adminworld

    adminworld Well-Known Member

    Messages:
    287
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    130
    #9
    What are you guys talking about ? I have no problem myself placing an ad in a header or anywhere else for that matter. I have a feeling that you dont undertand what i want.

    I have my ad in subsilver2 vietopic_body.html but i want my ad to show only in first 2 post BUT it keeps showing in every post. (Yes, after the first 3 its not visible but the code is still there and some browsers and bots can see it).

    Can someone help me with this or is this really too complicated ?
     
    Last edited: Jul 22, 2012
    adminworld, Jul 22, 2012 IP
  10. mnmani

    mnmani Well-Known Member

    Messages:
    379
    Likes Received:
    11
    Best Answers:
    6
    Trophy Points:
    195
    #10
    ^ it is really complicated .. there is no easy method to limit the advt code to first two posts on phpBB forum
     
    mnmani, Jul 22, 2012 IP
  11. adminworld

    adminworld Well-Known Member

    Messages:
    287
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    130
    #11
    So what will it take for this to happen ? Whats the complicated way ? I do not want to give any access to my cpanel like most people have ask i want to do it myself. There is no problem for increasing the price, i just need a person who knows whats he doing and could navigate me correctly.

    P.S. Look at Digitalforum, they have an ad after first post and it doesnt repeat itself all the time. They did it somehow! I am sure its possible.
     
    adminworld, Jul 22, 2012 IP
  12. mnmani

    mnmani Well-Known Member

    Messages:
    379
    Likes Received:
    11
    Best Answers:
    6
    Trophy Points:
    195
    #12
    ^ you can have advt after the first post only on the phpBB forum. that is, we can not limit it to the first two posts .

    find <!-- END postrow --> on viewtopic_body.html (subsilver2 style)

    place your advt code just above <!-- END postrow --> like below ; remember refreshing the cache !!

    <!-- IF postrow.S_FIRST_ROW -->
    your advertisement code here
    <!-- ENDIF -->
    
    Code (markup):
     
    mnmani, Jul 22, 2012 IP
  13. adminworld

    adminworld Well-Known Member

    Messages:
    287
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    130
    #13
    I am starting to believe that its impossible to do what i want. I cant find an answer online nor people on this forum that would know how to limit those ads.

    Mnmani, thanks for that but i do not want to place after the post. I believe that staying inside a post there is a way bigger chance that someone will click it (maybe even accidentally). I am not sure how search engines bots will react to the fact that my ad code is showing inside every post. This could be a problem. My forum is so new that i am not too worried about that yet but time will show.

    Thanks guys for trying.
     
    adminworld, Jul 23, 2012 IP
  14. mnmani

    mnmani Well-Known Member

    Messages:
    379
    Likes Received:
    11
    Best Answers:
    6
    Trophy Points:
    195
    #14
    well, advertisement can be a part of first post only. that is, it can be placed within the first post.

    find below code on viewtopic_body.html
    <!-- END attachment -->
    	</table>
    <!-- ENDIF -->
    Code (markup):
    add your advertisement code just after above code
    <!-- IF postrow.S_FIRST_ROW -->
    your advertisement code
    <!-- ENDIF -->
    Code (markup):
    however we cannot have it easily on the second post. but we can have another advt at the end of page.
     
    mnmani, Jul 23, 2012 IP