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
Issues While Trying To Add Javascript Ad Code
Avatar
AP
Member
Free Members
sp_UserOfflineSmall Offline
Sep 27, 2015 - 11:50 pm

Hi Friends,

 

I am trying to add a javascript ad code per the link below however I'm unable to save the theme php file. Is there something I'm missing? I would be very grateful for any help someone could provide.

https://simple-press.com/docum.....the-forum/

 

Eg.

 

sp_SectionEnd('', 'post');

if($spTopicView->currentPost==1) {
echo '<script id="mNCC" language="javascript"> medianet_width='336'; medianet_height= '280'; medianet_crid='XXXXXXX '; </script> <script id="mNSC" src="http://contextual.media.net/nmedianet.js?cid=XXXXXXX " language="javascript"></script>';
}

 

Note: I've replaced the numeric value to XXXXXXX within the code here for policy concerns.

I wish to insert an ad under the topic and if possible would like to add it under the reply post as well. Is there any suggestion on how I can have it appear under the topic?

 

Many thanks!

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Sep 27, 2015 - 11:57 pm

looks like a php syntax error there...  you are enclosing the echo string in single quotes... but then you use single quotes around the width, height and medianet attributes... so invalid syntax...

need something like:

if ($spTopicView->currentPost == 1) {
    echo '
        <script id="mNCC" language="javascript"> medianet_width="336"; medianet_height= "280"; medianet_crid="XXXXXXX"; </script>
        <script id="mNSC" src="http://contextual.media.net/nmedianet.js?cid=XXXXXXX" language="javascript"></script>
    ';
}

should work...  make sure you use the raw code copy so as not to mangle the single and double quotes...

Avatar
AP
Member
Free Members
sp_UserOfflineSmall Offline
Oct 2, 2015 - 6:10 pm

Thank you for replying back. I had tried to update per the raw code you've provided, however I am noticing the page won't save. Somehow it seems the there's still an issue. Is there another work around or suggestion that you could provide?

 

Thank you for all the support and time.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Oct 3, 2015 - 1:07 am

what do you mean by page wont save???  where are you putting it?  you should be editing a theme template file...  easiest to do via ftp and upload it...

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