Author |
Topic |
Running925
Starting Member
USA
28 Posts |
Posted - 03 September 2009 : 13:54:05
|
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" /> |
Edited by - Shaggy on 04 September 2009 04:48:02 |
|
balexandre
Junior Member
Denmark
418 Posts |
Posted - 03 September 2009 : 17:01:56
|
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
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:
|
Bruno Alexandre (Strøby, DANMARK)
"a Portuguese in Danmark"
|
Edited by - balexandre on 03 September 2009 17:04:28 |
|
|
Running925
Starting Member
USA
28 Posts |
Posted - 04 September 2009 : 09:18:48
|
that is exactly what i was looking for.
thanks a ton!! :) |
|
|
balexandre
Junior Member
Denmark
418 Posts |
Posted - 04 September 2009 : 09:46:17
|
see how easy it was |
Bruno Alexandre (Strøby, DANMARK)
"a Portuguese in Danmark"
|
|
|
Running925
Starting Member
USA
28 Posts |
Posted - 04 September 2009 : 10:17:42
|
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? |
|
|
Running925
Starting Member
USA
28 Posts |
Posted - 04 September 2009 : 10:41:58
|
n/mind, i figure it out! |
|
|
Running925
Starting Member
USA
28 Posts |
Posted - 04 September 2009 : 10:58:01
|
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
|
Edited by - Running925 on 04 September 2009 11:03:31 |
|
|
Running925
Starting Member
USA
28 Posts |
Posted - 04 September 2009 : 11:19:47
|
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 " |
|
|
AnonJr
Moderator
United States
5768 Posts |
Posted - 04 September 2009 : 15:03:57
|
Try:
|
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 04 September 2009 : 15:40:57
|
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
|
|
|
Running925
Starting Member
USA
28 Posts |
Posted - 04 September 2009 : 16:41:35
|
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. |
|
|
leatherlips
Senior Member
USA
1838 Posts |
|
Running925
Starting Member
USA
28 Posts |
Posted - 05 September 2009 : 00:01:16
|
quote: Originally posted by leatherlips
Have you tried putting inside of a div tag? You could do something like <div align="center">Your Content</div>
yea, it didn't seem to work... |
|
|
Classicmotorcycling
Development Team Leader
Australia
2084 Posts |
Posted - 05 September 2009 : 02:03:28
|
Have you tried putting a simple align tag in:
if ( iForum Mod 3 = 0 ) then Response.Write "<tr>" & VbCrLf & _ " <td bgcolor=""" & CColor & """ align=""center"" valign=""top"" width=""" & strTopicWidthLeft & """ colspan=""3"">" & VbCrLf %> <!--#INCLUDE FILE="midpost.html"--><% Response.Write " </td>" & VbCrLf & _ "</tr>" end if |
Cheers, David Greening |
|
|
balexandre
Junior Member
Denmark
418 Posts |
Posted - 05 September 2009 : 07:51:52
|
the proper css rule if using a div is
.googleads { width: 100%; text-align: center; }
you can easily add this into your midpost.html file.
the problem you had when inserting the Google Code in your code is the breakin's, you have to break each line in VBScript, the include file is always the best way to go as it turns your script much more accessible for later updates.
|
Bruno Alexandre (Strøby, DANMARK)
"a Portuguese in Danmark"
|
|
|
phoenixtaz13
Junior Member
129 Posts |
Posted - 05 September 2009 : 20:50:30
|
hi.. Good day to all.... :)
how can u make ads appear only once or twice?... and if a forum topic reaches 2 or 4 pages, how can u make ads appear once or twice per page?... coz what i remember with Google adsence TOS, u can only have maximum of 3 ads displayed in a page.
|
|
|
Topic |
|