Support Forum

Best way to integrate advertisements?

CC Cringe Channel
Cringe Channel
Member

hello,

Anyone have any tips on the best wayo integrate ads? Maybe between people’s posts?

I currently have one in the header above the forum,but I’m not sure it’s getting much use.

Thoughts?

Thanks

10 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

The easiest is to place your code directly into the SP theme templates. That way you can put it wherever you want it and in as many places as you want.

CC Cringe Channel
Cringe Channel
Member

Yellow Swordfish said
The easiest is to place your code directly into the SP theme templates. That way you can put it wherever you want it and in as many places as you want.

 

Thanks. I don’t know what I am doing. Can you tell me EXACTLY where to put my ad code so that it appears between the first post in the thread and the second post in the thread?

Thanks

YS Yellow Swordfish
Yellow Swordfish
Member

The article on our codex ‘how to’ FAQs describes exactly that actually:

http://codex.simple-press.com/codex/faq/problem-with-post-edit-buttonow-to/faq-how-to-display-ads-in-the-forum/

CC Cringe Channel
Cringe Channel
Member

Follow the instructions but got this error…

 

Parse error:  syntax error, unexpected T_STRING, expecting ‘,’ or ‘;’ in /problem-with-post-edit-buttonome/cringech/public_html/wp-content/sp-resources/forum-themes/mytheme/templates/spTopicView.php on line 199

 

This is what i integrated into my spTopicView.php

 

if($spTopicView->currentPost==1)

{echo ‘<div id=’div-gpt-ad-1385134515547-2′ style=’width:728px; height:90px;’>

<script type=’text/javascript’>

googletag.cmd.push(function() { googletag.display(‘div-gpt-ad-1385134515547-2’); });

</script>

</div>’;

}

YS Yellow Swordfish
Yellow Swordfish
Member

Well the first thing to correct is the fact that you placed the string to echo in single quotes. But the string itself contains single quotes so it has confused the interpreter.

use double quotes for the echo statement instead.

YS Yellow Swordfish
Yellow Swordfish
Member

I wouldn’t really know. The script is there as it should be but it seems to be acting upon this CSS:

div[id^=”div-gpt-ad-“] {
    -moz-binding: url(“about:abp-elemhidehit?727251689742#dummy”) !important;
}

which appears to cause it to not display. I think you need to talk to the ad supplier for more help as I can assure you the script is in place as you want it.

Or — the script has also changed from being ‘Javascript’ to ‘Rocketscript’ which I believe is spmething to do with Cloudflare so perhaps that is having some impact?

CC Cringe Channel
Cringe Channel
Member

i dont really understand.. the ad script works perfectly everywhere else on the site.

Can you tell me what I should try next to fix this?

YS Yellow Swordfish
Yellow Swordfish
Member

As I already said – I have no real idea. TRhe script IS in place. Look – this is the source being generated fpr that area of the page:

...
<p>???????????????????</p>
</div>
</div>
<div class='spPluginSection spCenter' style='width: 100%; min-height: 40px;' style='width: 100%; min-height: 40px;'>
</div>
<div style='clear: both; height:1px;'></div>
<div id='spThanksList24033' class='spThanksList spInlineSection'></div><div style='clear: both; height:1px;'></div>
</div>
</div>
<div id='div-gpt-ad-1385134515547-2' style='width:728px; height:90px;'>
 <script type='text/rocketscript'>
 googletag.cmd.push(function() { googletag.display('div-gpt-ad-1385134515547-2'); });
 </script>
 </div><div class='spTopicPostSection spEven spType-Admin spRank-admin spSpecialRank-admin spUserPost' id='post24050'>
 ...

You can see your  script is in there plain and simple.

And this is the CSS beinbg generated for that section – I assume from somethign to do with this ad featire that you haver installed:

div[id^="div-gpt-ad-"] {
    -moz-binding: url("about:abp-elemhidehit?727251689742#dummy") !important;
}

Something is causing it to be invalid. I have no idea what though. I do not see anything that SP is doing that can in any way effect this. As you can see – it is in the generated code.

BR Brandon
Brandon
Member

My suggestion. Get out of php, put in your div and script, turn php back on.

if($spTopicView->currentPost==1)  { ?>

<div id=’div-gpt-ad-1385134515547-2′ style=’width:728px; height:90px;’>
<script type=’text/javascript’>
googletag.cmd.push(function() { googletag.display(‘div-gpt-ad-1385134515547-2’); });
</script>
</div

<?php }