Advertisement after 5 records

flyboeing 22 Nov, 2010
Hi,
I have got a question about displaying advertisement in my connectivity form. It displays 10 results per page, but after 5 records I want to show a advertisement (a banner). How can I make something like that?
GreyHead 22 Nov, 2010
Hi flyboeing,

I guess you could use JavaScript to pop something up.

Bob
flyboeing 25 Nov, 2010
Ow okey. I will think of something :wink:
flyboeing 06 Dec, 2010
I thought about it for some time and searched google for my answer. I also found an example of what I would like to have: Click!

I have a banner of a website. This banner has to be visible after 5 records are shown (just like in the example). So between record 5 and 6 I want to show the banner.

Does anyone have an idea how to make this? I am not an expert in php😶

Kind regards,
Ruud
GreyHead 06 Dec, 2010
Hi flyboeing,

You can do this with a counter. In the Header box add
<?php
global $i;
$i = 0;
?>

and in the Body box:
<?php
global $i;
if ( $i == 5 ) {
  echo "<tr><td colspan='99'>Put advert here</td></tr>";
}
$i++;
?>

Bob

Bob
flyboeing 06 Dec, 2010
Hi Bob,

Thank you for your help. Now it is working very well!
I found some script on the internet, but couldn't get that one to work. This really helped me out😀
flyboeing 06 Dec, 2010
but now I encountered an error or bug or something....

I have put these codes in the right place, but when I set my List Limit to 6 in the backend admin settings, all the results are still be shown in my list. When I select '5' in my pagination (in the frontend) it will show just 5 records. Is there some kind of error? I want to show 10 records per page. No more, no less...
GreyHead 08 Dec, 2010
Hi flyboeing,

Please post a link to the listing so we can take a quick look.

I'm not sure if it is possible to lock the number of records to 10. ChronoConnectivity uses the Joomla! pagination code and I think that has to include the drop-down. . . . Though as I write this I think we have done this in the past by using CSS or JavaScript to hide the drop-down so that it can't be changed.

The number of precords per page is passed in a hidden form input.

Bob
This topic is locked and no more replies can be posted.