hi,
i search a plugin/mod/hack to insert my googleAds after X Tutorials
i have see it on the site from scott :
http://tutorialtoday.com/
have anyone an idea how can i insert ads like the site from scott?
thx and greetz from germany
Marcus
I just edited /includes/classes/tutorial.php to do that.
Code:
if($i == 2 || $i == 5 || $i == 8) {
$loop_bit_code .= 'put adsense code in here and put HTML around it to fit with layout';
}
Basically where you add it is before the $i++; in the functions that display the tutorials. The functions I have edited are common_tutorials() [ line 29 ], tutorial_sort_tutorials() [ line 194 ], tutorial_sort_view() [ line 394 ], show_sourcesite [ line 584 ].
Each function you edit add the code I said above in the "while($row = mysql_fetch_array($result)) {" loop and put it just before the $i++; with exception to the first function common_tutorials() which is a switch statement, only add it to the code after "case 'latest':".
hi,
thx scott
but i will add the GoogleAds automaticly after X Tutorials
but i will not add $i==2 || $i==5 || $i==8 || .... || $$i==99
gives maybe a alternative to this method?
thx & greetz
marcus
If you mean you want to show it after every certain amount of tutorials regardless of how many times then you could do this.
Code:
if(($i % 3) == 0) {
$loop_bit_code .= 'put adsense code in here and put HTML around it to fit with layout';
}
This will put the code after every 3 tutorials (or change the 3 to whatever amount you want).
Although I don't recommend this because if some had made it to show 100 tutorials then you would have the adsense unit showing up way to much and I think it is against their terms of service to have more then a certain amount on 1 page. (I am not sure the exact amount)
hm.. yes.. but when i show it every 15 or 20 tutorials.. it will be show 5 or 6 adsense per page.. i think it's okay
big thx scott... LOVE YOU :-* *gg*
greetz
marcus