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.

Inserting ads in phpBB3

Description: How to insert ads on your forum, minimizing the impact on "core" phpBB3 files.

In Categories:

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

Inserting ads

If you have a popular forum you might want to put some ads on it. Depending on your forum popularity you can gain back money you paid for your site hosting (likely) or buy a Porsche (very unlikely).

Just to give you an idea, my forum has about 600 users (238 posts a day) and I got about 150 euros in one year. I don't drive a Porsche but I can pay the provider bill.

You can have banners everywhere on your board, but the most useful places are:

1) your board's home page (i.e. the page showing all the forums of your board);
2) the page showing all threads in a given forum;
3) the page showing posts in a given thread.

These places also have another advantage: they are all pages with a content (Google, for instance, wants its banner to appear only on pages having content, this means you can't put them on the login page, for instance).

The files you must modify to have the banners on the above pages are respectively:

1) <your forum root>/styles/<style name>/template/index_body.html
2) <your forum root>/styles/<style name>/template/viewforum_body.html
3) <your forum root>/styles/<style name>/template/viewtopic_body.html

where "<your forum root>" is the directory where your forum resides and "<style name>" can be "prosilver" or "subsilver2".

"Quick and dirty" solution

Open the three files listed above and after

Code: Select all

<!-- INCLUDE overall_header.html -->


add the code given by your ads provider. That's all.

Cleaner solution

If you think that you'll want to modify your ads policy (or change your ads provider) but you don't want to modify six files everytime, the following solution is for you. This is also a good idea to make as little modification as possible to phpBB core files, so that the upgrade procedure can work without troubles.

Create the following files:

1) <your forum root>/ads/index.html
2) <your forum root>/ads/viewforum.html
3) <your forum root>/ads/viewtopic.html

(directory "<your forum root>/ads" must be created as it is not part of phpBB3)

Insert your ads code in the above (three) files then make the following modifications:

1) open both files <your forum root>/styles/<style name>/template/index_body.html and after the line

Code: Select all

<!-- INCLUDE overall_header.html -->


insert

Code: Select all

<!-- INCLUDE ../../../ads/index.html -->


2) open both files <your forum root>/styles/<style name>/template/viewforum_body.html and after the line

Code: Select all

<!-- INCLUDE overall_header.html -->


insert

Code: Select all

<!-- INCLUDE ../../../ads/viewforum.html -->


3) open both files <your forum root>/styles/<style name>/template/viewtopic_body.html and after the line

Code: Select all

<!-- INCLUDE overall_header.html -->


insert

Code: Select all

<!-- INCLUDE ../../../ads/viewtopic.html -->


This way, every time you want to modify your ads policy/provider you just have to modify the files under directory "<your forum root>/ads/".

PLEASE NOTE: for this modification to be effective you must clear the cache (there is a button for that in the ACP home page).