This section contains detailed articles elaborating on some of the common issues phpBB users encounter while using the product. Articles submitted by members of the community are checked for accuracy by the relevant phpBB Team. If you do not find the answer to your question here, we recommend looking through the Support Section as well as using the Site Wide Search.

Advertisements in phpBB3

Description: Learn in this article how to add advertisements in phpBB3.

In Categories:

Link to this article: Select All
[url=https://www.phpbb.com/support/docs/en/3.0/kb/article/advertisements-in-phpbb3/]Knowledge Base - Advertisements in phpBB3[/url]

Advertisements in phpBB3

Hello.

One frequently asked question is how to add ads in phpBB3 Olympus. The short answer is very simple: start your favourite text editor and open the correct .html template file. But which template file? Here's the longer answer....

First, open your favourite text editor and then....

Ads in the header

If you want ads in your header, open styles/prosilver/template/overall_header.html and add your code at the very end of the file.

Ads in the footer

If you want ads in your footer, open styles/prosilver/template/overall_footer.html

Find:

Code: Select all

<!-- IF U_ACP --><br /><strong><a href="{U_ACP}">{L_ACP}</a></strong><!-- ENDIF -->


Add your code after that line. You may need to include one or two <br /> to get line breaks (newlines) if you so desire.

Important note: Check with your ad provider before you put your ads in the header or footer. Some providers (like Google AdSense) only allow ads on pages that have actual content like the view topic or view forum pages.

Ads in view forum page

If you want ads in the view forum page that lists all the topics in that forum, open styles/prosilver/template/viewforum_body.html and add your code after this line:

Code: Select all

<!-- INCLUDE overall_header.html -->


Ads before or after the first post in a topic

If you want ads either before or after the first post in a topic, open styles/prosilver/template/viewtopic_body.html

For ads before the first post, find the line below and add the sample code after this line.

Code: Select all

<!-- BEGIN postrow -->


For ads after the first post, find the line below and add the sample code before this line.

Code: Select all

<!-- END postrow -->


Here is the sample ad code:

Code: Select all

   <!-- IF postrow.S_FIRST_ROW -->
   <div class="post bg2">
      <div class="inner"><span class="corners-top"><span></span></span>

      <div class="postbody">
         <h3>{postrow.POST_SUBJECT}</h3>
         <p class="author"><strong>Sponsor</strong></p>

         <div class="content" style="text-align: center;">
            Insert your ad code here
         </div>
      </div>
      
      <dl class="postprofile" id="profile0000">
         <dt>
            <strong>Sponsor</strong>
         </dt>

         <dd>&nbsp;</dd>
      </dl>
      
      <div class="back2top"><a href="#wrap" class="top" title="{L_BACK_TO_TOP}">{L_BACK_TO_TOP}</a></div>
      <span class="corners-bottom"><span></span></span></div>
   </div>
   <hr class="divider" />
   <!-- ENDIF -->


Of course, replace Insert your ad code here with the ad code your provider gives you.

Ads that blend in with the proSilver style

If you want your ads to blend in with proSilver and have a nice blue background with rounded corner images (note: this is not needed if you followed the instructions above for adding the advertisement before or after the first post in a topic), then use this code in any template file where you want your ads to appear:

Code: Select all

<div class="panel">
   <div class="inner"><span class="corners-top"><span></span></span>
      <div class="content">
         <p style="text-align: center;">
            Insert your ad code here
         </p>
      </div>
   <span class="corners-bottom"><span></span></span></div>
</div>


Of course, replace Insert your ad code here with the ad code your provider gives you.

If you have any suggestions or find in bugs with this article, please send me a Private Message.

Enjoy! :mrgreen: