Here's a handy tip for those who are using one template:
- Code: Select all
OPEN INCLUDES/PAGE_HEADER.PHP
FIND
define('HEADER_INC', TRUE);
AFTER, ADD //Only visible for guests
if ( $userdata['session_logged_in'] && ($googlead=="1") ){
$google_ad = '';
}
if ($googlead=="1") {
$google_ad = '<table class="forumline" width="95%" cellspacing="1" cellpadding="3" border="0">
<tr>
<td class="row1" height="100%" valign="top">
<div align="center">
YOUR ADSENSE CODE
</div>
</td>
</tr>
</table>';
}
FIND
'SITENAME' => $board_config['sitename'],
BEFORE, ADD
'GOOGLE_AD' => $google_ad,
OPEN TEMPLATES/YOURTEMPLATE/OVERALL_HEADER.TPL
FIND
</table></td>
</tr>
</table>
AFTER, ADD
{GOOGLE_AD}
Now you can add this code on every page where you want the ads to show like in index.php, viewforum.php and viewtopic.php
- Code: Select all
FIND
define('IN_PHPBB', true);
BEFORE, ADD
$googlead="1";
The code in page_header.php makes it only visible to guests.
If you want it to also show for logged in users, use this:
- Code: Select all
AFTER, ADD //Visible for everyone
if ($googlead=="1") {
$google_ad = '<table class="forumline" width="95%" cellspacing="1" cellpadding="3" border="0">
<tr>
<td class="row1" height="100%" valign="top">
<div align="center">
YOUR ADSENSE CODE
</div>
</td>
</tr>
</table>';
}
I hope it's useful.
You can see it in action on my Aibo forum

English |
French

