Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Using javascript in the forum description
Avatar
MMA Fighting
Rookie
Free Members
sp_UserOfflineSmall Offline
May 26, 2013 - 5:23 am

Hi, I'm looking to use javascript in the description underneath each forum (google dfp specifically). I've search the forum and not found and answer to do it, only ones to insert the code into the theme template.

I've attached a couple of images to better show where I'd like to place the ads, which I'm hoping you'll be able to help with. I'd appreciate it a lot.

Thanks

 

1.jpgImage Enlarger2.jpgImage Enlarger

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
May 26, 2013 - 10:36 am

you can insert into any number of locations with our hooks or simply by editing the template file of your sp theme where you want it to show just like you would a wp template file in a wp theme... be sure its your own theme to preserve changes on upgrades...

more: http://codex.simple-press.com/.....the-forum/

Avatar
MMA Fighting
Rookie
Free Members
sp_UserOfflineSmall Offline
May 26, 2013 - 12:24 pm

Do you know where that location for the descriptions is in the template by any chance? I can't seem to find it.

Thanks

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
May 26, 2013 - 2:49 pm

did you look at:  http://codex.simple-press.com/.....the-forum/

it was pretty explicit with examples...

you werent specific on area, but if its after a forum description, it would be in the spGroupView.php or spForumView.php template file..

Avatar
MMA Fighting
Rookie
Free Members
sp_UserOfflineSmall Offline
May 26, 2013 - 10:26 pm

I've made some progress, ie got as far as finding the right location in the template. As my ad codes are javascript, and I need to place a different code under each forum those tags don't make a good combination. I think I need to do an if statement such as:

if

(

$spGroupView

->currentGroup==1) || (

$spGroupView

->currentForum==1){

echo

'my ad code here'

;

}
 
To be able to display different codes under each separate forum, but when I add my ad code after echo I'm getting a syntax error as it's javascript.
 
An example of the ad code I'm using is:
<!-- 1_Member_Intro -->
<div id='div-gpt-ad-1369581029840-10' style='width:468px; height:60px;'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1369581029840-10'); });
</script>
</div>
I've added another screenshot to show exactly where I'm trying to place my ads.
Any ideas?

Thanks

Untitled.jpgImage Enlarger

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
May 27, 2013 - 12:19 am

doesnt look like you are using the code button properly...  enter your code, highlight and select the code button... looks like ${}

your image doesnt really indicate where you want to do it... its just a list of forums... so under each one???

so thats spGroupView.php... so probably right before this code:

                            sp_SectionEnd('', 'forum');

if you want different code per forum, then check the forum id, something like:

if ($spThisForum->forumid == xx) {
    # your code here
}

where you replace xx with the forum id in question... you can make a switch statement or complex if to check all forum ids if needed...

also, if you are entering js, be sure to exit php mode with ?> and then restart it again with <?php

 

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: 619
Members: 17361
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625