Firefox PHP

insert pre-defined row after every x message on listing page

Posted by Mark Fresh 
insert pre-defined row after every x message on listing page
January 18, 2007 12:48PM
Similar to this post I would like to make every x row on the messages list page contain some predefined text. e.g. after ever 10 messgaes i could show a row that says "register and receive benefits..." or I could place in some some PHPadsnew code.

Please could someone tell me how to do this if possible?

thanks

Mark
Re: insert pre-defined row after every x message on listing page
January 19, 2007 12:19PM
You'll have to add some logic to the list template. You can add some pure PHP code to do this. I won't do the full template change for you, but here's some hints.

Before {LOOP MESSAGES}, you'll have to initialize a counter. Right after it, you can increment that counter and act on it. Look at the green code in the example below:
............................
.. original template code ..
............................

<?php $rowcount = 0; ?>

{LOOP MESSAGES}

<?php $rowcount ++; if ($rowcount % 10 == 0) { ?>
<tr>
  <td class="PhorumTableRow">
    Your template code for adding advertisements
    or whatever can go in this spot.
  </td>
</tr>
<?php } ?>

............................
.. original template code ..
............................

Untested code, but I think this should get you going.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: insert pre-defined row after every x message on listing page
February 26, 2007 10:10PM
works a treat, thank you
Sorry, only registered users may post in this forum.

Click here to login