Support Forum
Awesome! Thanks for the help everyone!
By the way, if you want to display your Adsense ads in multiplie locations, like say on the 1st and 5th post in a topic, you can modify your function code as follows:
if($spTopicView->currentPost==1 OR $spTopicView->currentPost==5){ //display if 1st or 5th post if (function_exists('show_ad')) show_ad(); }
Keep in mind that Adsense only allows 3 ads per page. So maybe you could modify even further for 1st, 5th, and 10th post. Or you could create separate functions for 3 different ad sizes and place them in 3 distinct locations (header, post1, and footer).
Thanks again for this post. It helped me find the right locations to place my ad code!
yup... the sp template files are simply php... you can do whatever kind of special logic you want... if you get in pretty heavy, dont forget about the data inspector on forum - toolbox - data inspector... will help with available data...
Visit Cruise Talk Central and Mr Papa's World
to learn about the basics of themes, see: http://codex.simple-press.com/.....ng-themes/
Visit Cruise Talk Central and Mr Papa's World
Hello ! Just a little message to say "thank you", because the information provided by Brandon C on page 3 are very clear and useful !
I've just set up adsense on my forum in a few minuts !
And if you want to display the banners every 5 posts, just use this code :
if ($spTopicView->currentPost % 5 == 0) { if (function_exists('show_ad')) show_ad(); }
Myriam HERVE said
Hello ! Just a little message to say "thank you", because the information provided by Brandon C on page 3 are very clear and useful !I've just set up adsense on my forum in a few minuts !
And if you want to display the banners every 5 posts, just use this code :
<br />
if ($spTopicView->currentPost % 5 == 0) { if (function_exists('show_ad')) show_ad(); }<br />
What do I have to change if the code should appear always in the last post?
Or maybe the first and the last post?
THX
try
if ($spTopicView->last_post_on_page)
or
if ($spThisPost->first_post_on_page || $spThisPost->last_post_on_page)
you should take a look at forum - toolbox - data inspector... great way to look at the info available on page views...
Visit Cruise Talk Central and Mr Papa's World
Mr Papa said
just change your checks on the current post position...
<br />
if ($spTopicView->currentPost == 1 || $spTopicView->currentPost == 3 || $spTopicView->currentPost == 4)<br />
or break it up into separate 'if' statements...
Thanks for that, it's work good, i try this code before:
if
(
$spTopicView
->currentPost==1) || (
$spTopicView
->currentPost==4){
echo
'my ad code here'
;
}
the code you entered is not syntactically correct and has php errors in it... you probably want something like this:
if ($spTopicView->currentPost==1 || $spTopicView->currentPost==4) {
echo 'my ad code here';
}
but I am not sure what you want, so try it and see if it gives you what you want with your php error fixed... come on back if not what you want...
Visit Cruise Talk Central and Mr Papa's World
1 Guest(s)