Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
coding-topic
Adsense code
Avatar
ausip
Member
Free Members
sp_UserOfflineSmall Offline
Feb 21, 2012 - 8:15 am

I read in the features that hooks are now obsolete...

 

If that is the case, where do I find the information to include adsense code in my forum templates?

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Feb 21, 2012 - 11:25 am

mainly still in the process of being written.
But there are many options. probably best at the moment if you tell us where you want to put it and we can advise on the best approach...

andy-signature.png
YELLOW
SWORDFISH
Avatar
ausip
Member
Free Members
sp_UserOfflineSmall Offline
Feb 21, 2012 - 3:47 pm

The main place I would like to put advertising to begin with would be after the first post on the topic page.

 

Thanks

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Feb 21, 2012 - 7:54 pm

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/

Avatar
ausip
Member
Free Members
sp_UserOfflineSmall Offline
Feb 22, 2012 - 12:37 am

Thanks for that. There are a couple of other locations that I need to know about too.

I am using the Social Connect plugin and want to include it's code in the login for Simple:Press. What is the location in the code to include it between the password and Login button, after clicking on Login to display these fields.

 

I also want to include some social networking buttons on each topic. This would need to go at the bottom of each topic post and reply.

 

I look forward to your reply, so I can start inserting some code in a custom template.

Thanks

Paul

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Feb 22, 2012 - 8:05 am

If you take a look at the template files and compare them to the display of the forum it really is pretty easy to work out the structure. Each display element simply has it's own function and you can add standard php and html code anywhere you like. Just echo the output.

andy-signature.png
YELLOW
SWORDFISH
Avatar
CharliePryor
Guest
Guests
Mar 8, 2012 - 5:55 pm

I'm really new at this whole PHP thing... what is meant by an echo?

For example, I want to place a 728x90 Adsense ad below the first post of the forum, and under it (before the forum information section). I see the locations as to where to put it, from previous forum posts as well as this one, but I'm not familiar with how to "echo" it. I was placing the code there, and it was returning errors on the page.

 

Any help would be appreciated. A template of it would be so amazing, but It's not "expected" or anything. Thank you! 

Avatar
Brandon
U.S.
SP Wrangler
Free Members
sp_UserOfflineSmall Offline
Mar 8, 2012 - 8:32 pm

Here is how you can do it.

First create your own theme so any changes you make are not over written by updates. See here on how.

http://codex.simple-press.com/.....g-a-theme/

Since you want to use the adsense code in multiple paces I would create a function for it.

It appears you have seen the files in yourthemes/template folder.  One of the is spFunctions.php.  This is a file that you can add a function to, among other things, that your theme can use.

Create a function for your ad. Let's call it spAddCode

Open the spFuntions.php file up in your editor and at the bottom just above the closing ?> is where you can add the function.

Your function should look something like this.

function spAddCode() {

class="brush-php syntax">spAddCode();

Avatar
Jasneet Gulati
Member
Free Members
sp_UserOfflineSmall Offline
Jun 2, 2012 - 1:30 pm

Hi,

Thanks for the above information.

I have successfully implemented Adsense in the spHead.php

I now also want an add below the very first post of any topic. I know the code I need to place, but I am looking everywhere for:

Mr Papa said
 checking for $spTopicView->current_post==1, after the inner post loop...

right after these

                        sp_InsertBreak();

                    sp_SectionEnd('', 'post');

In which .php file will I find this bit of code so that I can echo my adsense code? I have checked spTopicView.php as well as several others.

Thank you,

JG

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Jun 2, 2012 - 1:41 pm

It IS spTopicView.php. You will find the bit Steve suggested in there.

andy-signature.png
YELLOW
SWORDFISH
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 620
Members: 17365
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626