This topic is locked

How to insert a banner ad between records on the List page

1/16/2014 5:56:11 PM
ASPRunnerPro Tips and tricks
admin

Lets say you run a free classified ads website. You need to insert some paid ads like banners or Google adwords between your free ads. Here is how you can do this.


ASPRunnerPro 6.x, 7.x and 8.x

  1. Open List page in Visual Editor and switch to HTML mode
  2. Find the following code snippet

{BEGIN grid_row}


and insert the following after this snippet

{BEGIN showheader}<TR>

<TD colSpan=20>Â Â Â Â

<H1>{$header}</H1></TD></TR>{END showheader}


3. Add the following code to List page BeforeProcess event. We need to reset the counter when page is loaded.

Session("rec_count")=0


4. Add BeforeMoveNextList (List page: After record processed) event:

if SESSION("rec_count")=5 then

row("showheader")=true

row("header")="<a href='http://www.xlinesoft.com/phprunner/'>"; & _

"<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=21867&image=2&table=forumtopics'>; </a>"

end if

SESSION("rec_count")=SESSION("rec_count")+1
G
gonzalosb 2/19/2014

it is possible to show more than 1 paid add and alternate every time the page is reloaded or refresh ?

first time ASPR add

1 refresh ASP.NETR add

2 refresh PHPR add

admin 2/19/2014

Yes, it's possible. The simplest form - you have a hardcoded list of banner images and links, say five banners. When it comes to displaying the banner you pick a randmon number ranging from 1 to 5 and display that banner. See examples of generating a random number at http://www.w3schools.com/vbscript/func_rnd.asp