Support Forum
I want to add a couple 728x90 google ads to my forum.
I think I know what to do if it just involves adding the google code. But on a post in this thread "https://simple-press.com/support-forum/sp5-coding-questions/adsense-code/" you mention "just use the php echo statement to output the adsense code".
How do I echo it / will it make any difference if I just add the code to the places I wish for them to appear?
Mr Papa said
you can just stick it in the template file for the sp theme you are using, checking for $spTopicView->current_post==1, after the inner post loop...right after these
sp_InsertBreak();
sp_SectionEnd('', 'post');
just use the php echo statement to output the adsense code... you might want to style it...
as always, we recommend you make your own sp theme before editing ours to prevent losing changes on upgrade... http://codex.simple-press.com/.....g-a-theme/
Many Thanks
Craig
It depends what form the code is that you need to insert. Normally you would just use that - an echo statement with the following text in quotes - as most adSense code I have seen is javascript. So just echo 'xxxx'; where the xxxx is the adsense code.
However you have to check for quotes within the adsense code. If the adsense code contains any single quotes then use double quotes with the echo and visa versa. And note the semi-colon at the end...
YELLOW
SWORDFISH
|
http://php.net/manual/en/funct.....n.echo.php
so something like:
echo 'your adsense code goes between these single quotes. make sure no single quotes in your adsense code or switch one of them to double quotes';
Visit Cruise Talk Central and Mr Papa's World
Ahh, I get it now. Thank you.
However I do still have one problem. I can't seem to locate the current_post==1?
you can just stick it in the template file for the sp theme you are using, checking for $spTopicView->current_post==1, after the inner post loop…
right after these
sp_InsertBreak();
sp_SectionEnd('', 'post');
just use the php echo statement to output the adsense code… you might want to style it…
I have found
sp_ColumnEnd();
sp_InsertBreak();
sp_SectionEnd('', 'post');
But when I add it here it shows an ad under every post.
Thanks again for all your help
The code is not already there.
What you want to do is add it to check and see if first post.
Here is a an example that shows how.
https://simple-press.com/suppo.....2/#p109115
but use the way shown on post #14 there.
1 Guest(s)