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

XF 1.2 Google Ads All 10 or 20 posts

Discussion in 'XenForo Questions and Support' started by bladinium, Nov 16, 2013.

  1. bladinium

    bladinium Active Member

    Hello, currently I'm using a code that adds a google ad (example) after every first post! I wish it were repeated every 10 or 20 posts possible?
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Change the value from 0 to 10.

    Or add a new block of code with a value of 10.
     
  3. bladinium

    bladinium Active Member

  4. RobParker

    RobParker Well-Known Member

    Thats potentially against the Adsense terms, if you're actually using google ads.
     
  5. EQnoble

    EQnoble Well-Known Member

    Only if you run more than three ads on a page I believe.
     
  6. RobParker

    RobParker Well-Known Member

    Yes. So if users were able to set it to show 40 posts per page...

    Like I said "potentially" :)
     
  7. EQnoble

    EQnoble Well-Known Member

    True dat, just clarifying as to the why behind your post.
     
  8. bladinium

    bladinium Active Member

    Hello and thank you for your help! I do not use Google adsense =) but actually it's good to clear!

    rather than repeating the code, I decided to modify the code with in_array

    Here it is (it's probably not perfect :)


    Code:
    <xen:if is="in_array({$post.position}, array(0, 15 ,30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180, 195, 210, 225, 240, 255, 270, 285, 300)) AND {$conversation.first_message_id} == {$message.message_id}">
        <li class="message">
    
            <div class="messageUserInfo">
                <div class="messageUserBlock">
                    <div class="avatarHolder"><span class="avatar  av2m"><img  src="URL AVATAR"  width="96px" height="96px"></span></div>
    
                    <h3 class="userText">
                        Monsieur
                        <em class="userTitle" itemprop="title">Pub</em>
                    </h3>
    
                    <span class="arrow"><span></span></span>
                </div>
            </div>
    
          <div class="messageInfo primaryContent">
                <div class="messageContent">
                <blockquote class="messageText ugc baseHtml">
    <div align="center">        
    <!-- DEBUT DU SCRIPT SLIDER -->
        <xen:if is="in_array({$forum.node_id}, array(113 ,40 ,41 ,83 ,84 ,114 ,115 ,116 ,120 ,121 ,122 ,123 ,129 ,130 ,131 ,132 ,153 ,154 ,155 ,156 ,157 ,158 ,163 ,164 ,165 ,166 ,168 ,171 ,172 ,173 ,174 ,175 ,176 ,177 ,178 ,179 ,182 ,183 ,184 ,185 ,186 ,187 ,188 ,189 ,190 ,191 ,192 ,193 ,194 ,195 ,204 ,205 ,207 ,209 ,210 ,211 ,212 ,213 ,214 ,215 ,220 ,221 ,222 ,223 ,224 ,225 ,227 ,228 ,229 ,231 ,232 ,233 ,234 ,235 ,236 ,237 ,238 ,239 ,241 ,242 ,244 ,245 ,246 ,247 ,248 ,249 ,250 ,251 ,252 ,253 ,254 ,255 ,256 ,257 ,262 ,263 ,264 ,265 ,266 ,267 ,268 ,269 ,270 ,271 ,273 ,274 ,275 ,276 ,278 ,279 ,280 ,285 ,286 ,287 ,288 ,289 ,290 ,291 ,292 ,293 ,294 ,295 ,296 ,297 ,298 ,299 ,300 ,301 ,302 ,303 ,304 ,305 ,306 ,307 ,308 ,309 ,310 ,311 ,312 ,313 ,314 ,315 ,316 ,317 ,318 ,319 ,320 ,321 ,322 ,323 ,324 ,325 ,326 ,327 ,328 ,329 ,330 ,331 ,332 ,333 ,334 ,335 ,336 ,337 ,338 ,339 ,340 ,341 ,342 ,343 ,344 ,345 ,346 ,347 ,348 ,349 ,350 ,351 ,352 ,353 ,354 ,355 ,356 ,357 ,358 ,359 ,360 ,361 ,362 ,363 ,364 ,365 ,366 ,367 ,368 ,369 ,370 ,371 ,372 ,373 ,374 ,375 ,376 ,377 ,378 ,379 ,380 ,381 ,382 ,383 ,384 ,385 ,386 ,387 ,388 ,389 ,390 ,391 ,392 ,393 ,394 ,395 ,396 ,397 ,398 ,399 ,400 ,401 ,402 ,403 ,404 ,405 ,406 ,407 ,408 ,409 ,410 ,411 ,412 ,413 ,414 ,415 ,416 ,417 ,418 ,419 ,420 ,421 ,422 ,423 ,424 ,425 ,426 ,427 ,428 ,429 ,430 ,431 ,432 ,433 ,434 ,435 ,436 ,437 ,438 ,439 ,440 ,441 ,442 ,443 ,444 ,445 ,446 ,447 ,448 ,449 ,450 ,451 ,452 ,453 ,454 ,455 ,456 ,457 ,458 ,459 ,460 ,461 ,462 ,463 ,464 ,465 ,466 ,467 ,468 ,469 ,470 ,471 ,472 ,473 ,474 ,475 ,476 ,477 ,478 ,479 ,480 ,481 ,482 ,483 ,484 ,485 ,486 ,487 ,488 ,489 ,490 ,491 ,492 ,493 ,494 ,495 ,496 ,497 ,498 ,499 ,500 ,501 ,502 ,503 ,504 ,505 ,506 ,507 ,508 ,509 ,510 ,511 ,512 ,513 ,514 ,515 ,516 ,517 ,518 ,519 ,520 ,521 ,522 ,523 ,524 ,525 ,526 ,527 ,528 ,529 ,530 ,531 ,532 ,533 ,534 ,535 ,536 ,537 ,538 ,539 ,540 ,541 ,542 ,543 ,544 ,545 ,546 ,547 ,548 ,549 ,550 ,551 ,552 ,553 ,554 ,555 ,556 ,557 ,558 ,559 ,560 ,561 ,562 ,563 ,564 ,565 ,566 ,567 ,568 ,569 ,570 ,571 ,572 ,573 ,574 ,575 ,576 ,577 ,578 ,579 ,580 ,581 ,582 ,583 ,584 ,585 ,586 ,587 ,588 ,589))">
        <font size="3">MESSAGE NO PUBS
    <br>
    Le staff</font>
    <xen:else />
    SCRIPT ADS
    </xen:if>
    <!-- FIN DU SCRIPT SLIDER -->
    
                </div>
                  </blockquote>
                </div>
              </div>
          </li>
    </xen:if>
    My forum displays 15 posts per page, so each page has a pub on 20 Pages

    Thank you for your help :)
     

Share This Page