How to put ad spots between posts ?? - Postet den (2121 Views)
Starting Member
Running925
Innlegg: 28
28
I'm interested in finding out how i can automate a snipit of code to pop in-between every so many posts for ad space.
Any help would be appreciated.
Thank

tony

<moved from="Help: General / Current Version (v3.4.xx)" by="Shaggy" />
   
 Sidestørrelse 
Postet den
Junior Member
balexandre
Innlegg: 418
418
quite easy...
open topic.asp file

in the original file (v.3.4.07), at line 683 add:

right before the next in the loop For iForum = 0 to iReplyCount

Code:

if ( iForum Mod 2 = 0 ) then 
Response.Write "<tr>" & VbCrLf & _
"<td bgcolor=""" & CColor & """ valign=""top"" width=""" & strTopicWidthLeft & """ colspan=""3"">" & VbCrLf & _
" [CONTENT OF THE ADD] " & VbCrLf & _
"</td></tr>"
end if

Where iForum Mod 2 ... the 2 is the separation, if you want 3 by 3... write

iForum Mod 3


you will end up with something like:

Postet den
Starting Member
Running925
Innlegg: 28
28
that is exactly what i was looking for.

thanks a ton!! :)
Postet den
Postet den
Starting Member
Running925
Innlegg: 28
28
ok.. idk if my file is different or what but i'm having a hard time making this work. I put that code in on the line you said and it failed. so i moved it to where i thought it looked right (to me) and it poped in after the first post and nowhere else...
any suggestions?
Postet den
Starting Member
Running925
Innlegg: 28
28
n/mind, i figure it out!
Postet den
Starting Member
Running925
Innlegg: 28
28
Now i'm having a problem puting my adsense code in the spot where the txt is displaying. It thinks it's the end of a statement when it sees the google script...
This is what i've done: (Whats wrong here?)


if ( iForum Mod 2 = 0 ) then
Response.Write "<tr>" & VbCrLf & _
"<td bgcolor=""" & CColor & """ valign=""top"" width=""" & strTopicWidthLeft & """ colspan=""3"">"

& VbCrLf & _
" <script type="text/javascript"><!--
google_ad_client = "pub-7561796924071765";
/* 728x90, created 9/4/09 */
google_ad_slot = "1131326765";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script> " & VbCrLf & _
"</td></tr>"
end if

Postet den
Starting Member
Running925
Innlegg: 28
28
Even if i go like this:

if ( iForum Mod 3 = 0 ) then
Response.Write "<tr>" & VbCrLf & _
"<td bgcolor=""" & CColor & """ valign=""top"" width=""" & strTopicWidthLeft & """ colspan=""3"">" & VbCrLf & _
" <!--#INCLUDE FILE="midpost.html"-->" & VbCrLf & _
"</td></tr>"
end if


with nothing but some txt in the midpost file, it still gives me an error that states: Expected end of statement at the first "
Postet den
Forum Moderator
AnonJr
Innlegg: 5768
5768
Try:
Code:
if ( iForum Mod 3 = 0 ) then 
Response.Write "<tr>" & VbCrLf & _
"<td bgcolor=""" & CColor & """ valign=""top"" width=""" & strTopicWidthLeft & """ colspan=""3"">" & VbCrLf & _
" <!--#INCLUDE FILE=""midpost.html""-->" & VbCrLf & _
"</td></tr>"
end if
Postet den
Forum Admin
HuwR
Innlegg: 20611
20611
you can't use the include directive inside a response.write, it will not work, you have to end the script first so you would have to do

if ( iForum Mod 3 = 0 ) then
Response.Write "<tr>" & VbCrLf & _
"<td bgcolor=""" & CColor & """ valign=""top"" width=""" & strTopicWidthLeft & """ colspan=""3"">" & VbCrLf %>
<!--#INCLUDE FILE="midpost.html"-->
<% Response.Write "</td></tr>"
end if
Postet den
Starting Member
Running925
Innlegg: 28
28
you guys are Awesome!!

that worked HuwR

ony thing i'm tryin go square away now is i can't seem to get the ad to center it self in that cell. I've tried multiple ways to align it center (css / hard center) and i think the forum's propertys are taking priority on that because it continues to flush left on me.

If anyone has a suggestion then please toss it out there, i'd love to give it a shot. Otherwise, i might just live with it, at least it's on there!!

thanks again for the help guys.
Du må legge inn en melding