Forum advice :: How I placed Adsense on my forum.

Started by Niteblade, February 25, 2007, 09:47:21 PM

Previous topic - Next topic

mojito

The codes that are shown are significantly shorter than the original ones (unedited eg Display.template.php, so do we insert rather than replace the code in the grey box.And its not always clear where to insert the code in the grey box.

Is this mod for all versions ?
SMF 1.1 RC2 bridge 1.4

Niteblade

#21
Quote from: mojito on April 01, 2007, 12:56:06 PM
The codes that are shown are significantly shorter than the original ones (unedited eg Display.template.php, so do we insert rather than replace the code in the grey box.And its not always clear where to insert the code in the grey box.

Is this mod for all versions ?


Ok, I get what you're saying. The code inside the gray "code" box represent a small snippet of code that produces the over-all adsense placement. Referencing the entire code would not be a good idea because there are modifications out there that alter the code, and since not all people have all the same modifications installed, it would be a nightmare to tell people to use this one-and-only display.template.php, for example.

However, there are some common denominators inside these particular files. For example, regardless of your theme, and regardless of the modifications installed, there are some common snippets of code that must remain constant. As an example, I reference the "surrounding" code that serves as a cue to know what to look for inside the larger display.template.php.

In the first post, for example, when editing Display.template.php, you can search for

// Show the member's signature?
if (!empty($message['member']['signature']) && empty($options['show_no_signatures']))
echo '
<hr width="100%" size="1" class="hrcolor" />
<div class="signature">', $message['member']['signature'], '</div>';

echo '
</td>
</tr>
</table>
</td></tr>
</table>
</td></tr>';


(Display.template.php) The point of the matter is to place the small adsense snippet of code after the

</table>
</td></tr>';


However, if you have a signature modification installed, this may appear different.

When putting adsense directly into your template, seek out where tables close by searching for </table>. When I experiment, I place adsense code after a table closure.

The particular adsense code would be ::

// Adsense after first post.
if ($message['id'] == $context['first_message'])
{
&nbsp; &nbsp; echo '
&nbsp; &nbsp; &nbsp; &nbsp; <tr>
<td style="padding: 0px 1px 0 1px;">
<table width="100%" cellpadding="5" cellspacing="0" style="table-layout: fixed;">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <tr>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <td valign="top" width="85%" height="100%" class="windowbg2">
<div style="overflow: auto; width: 100%;" align="center" class="windowbg">
<script type="text/javascript"><!--
google_ad_client = "pub-";
google_ad_width = 468;
google_ad_height = 15;
google_ad_format = "468x15_0ads_al";
//2007-02-18: midessa-forum-468x15
google_ad_channel = "8866871717";
google_color_border = "423935";
google_color_bg = "423935";
google_color_link = "D0D0D0";
google_color_text = "000000";
google_color_url = "008000";
//--></script>
<script type="text/javascript"
&nbsp; src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
</td>
</tr>
</table>
<table width="100%" cellpadding="5" cellspacing="0" style="table-layout: fixed;">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <tr>
<td valign="top" width="85%" height="100%" class="windowbg">
<br />
<div style="overflow: auto; width: 100%;" align="center" class="windowbg">
<script type="text/javascript"><!--
google_ad_client = "pub-";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
//2007-02-18: midessa-forum-468x60
google_ad_channel = "8764535480";
google_color_border = "2B2B30";
google_color_bg = "2B2B30";
google_color_link = "FFFFFF";
google_color_text = "D0D0D0";
google_color_url = "F7DDAA";
//--></script>
<script type="text/javascript"
&nbsp; src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<br><br/>
</div>
<br />
</td>
</tr>
</table>
</td>
</tr>';
}
// End Adsense after first post.


However, I thought that it would be a good idea to pattern how adsense is displayed after how adsense is displayed on other popular forums, such as Digital Point.

In this case, the adsense code would look like this ::

// Adsense after first post.
if ($message['id'] == $context['first_message'])
{
echo '
<tr>
<td style="padding: 0px 1px 0 1px;">
<table width="100%" cellpadding="5" cellspacing="0" style="table-layout: fixed;">
<tr>
<td valign="middle" align="center" width="100%" class="windowbg2">
<script type="text/javascript"><!--
google_ad_client = "pub-1784233218325525";
google_ad_width = 728;
google_ad_height = 15;
google_ad_format = "728x15_0ads_al";
//2007-03-15: midessa-forum-728x15
google_ad_channel = "7377725223";
google_color_border = "323935";
google_color_bg = "323935";
google_color_link = "E9E9E9";
google_color_text = "D0D0D0";
google_color_url = "FFFFFF";
//-->
</script>
<script type="text/javascript"
&nbsp; src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td>
</tr>
</table>

<table width="100%" cellpadding="5" cellspacing="0" style="table-layout: fixed;">
<td valign="middle" align="center" width="100%" class="windowbg">
<script type="text/javascript"><!--
google_ad_client = "pub-1784233218325525";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text";
//2007-03-15: midessa-forum-728x90
google_ad_channel = "8891092745";
google_color_border = "2B2B30";
google_color_bg = "2B2B30";
google_color_link = "E9E9E9";
google_color_text = "D0D0D0";
google_color_url = "F7E0AA";
//-->
</script>
<script type="text/javascript"
&nbsp; src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td>
</table>

<table width="100%" cellpadding="5" cellspacing="0" style="table-layout: fixed;">
<td valign="middle" align="center" width="100%" class="windowbg2">
<script type="text/javascript"><!--
google_ad_client = "pub-1784233218325525";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text";
//2007-03-15: midessa-forum-728x90
google_ad_channel = "8891092745";
google_color_border = "323935";
google_color_bg = "323935";
google_color_link = "E9E9E9";
google_color_text = "D0D0D0";
google_color_url = "F7DDAA";
//-->
</script>
<script type="text/javascript"
&nbsp; src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

</td>
</table>
</td>
</tr>
';
}
// End Adsense after first post.


In anycase, I experiment with this quite often. If you find a post, any post, on my forum, you'll see what that code looks like.

In essence, then, I don't list the totality of a particular file because such files are modified and diverse. My template wouldn't be the same as templates found on other sites. However, despite the diversity, there must be some common denominators, and the adsense-snippet is placed after such commonalities.
affiliate blog

dabblingdiva


rsmini

Just deciding which two templates to use. Millenium works very well to display adsense after the 1st post but my other template .. Neptune.. does not have the display.template.php file for some reason.

Please can you give me any advice how to get around this so adsense will display in Neptune as well
Remember to check the website for the latest info & news on the Mini. -
British Mini Club

Harro

Then you have to change Display.template.php from the default theme.

rsmini

Quote from: Harro on April 25, 2007, 12:18:50 PM
Then you have to change Display.template.php from the default theme.

I thought it was that ... but I do like to check :) Thanks for your help I will try this later today as it does seem an easier way to get the adverts working
Remember to check the website for the latest info & news on the Mini. -
British Mini Club

rsmini

To only change display.template in the default theme when using "neptune theme" does not seem to work. I asked the question the in the neptune theme thread and received this reply

QuoteWhenever some template seems to be mssing in a theme, its because it hasn't changed it for itself - so it falls back on default theme.

This mod require also index.template and BoardIndex.template to be changed it seems - you need to change those too in Neptune.

Would be most grateful if someone could be so kind as to supply the code for these changes as I really do not know where to start. I am after the adsense ads appearing after the 1st post in neptune. At the moment this does not seem to work.

It works perfect in default and "millenium" but most of my members are using neptune. The easy answer of course is to change the default theme to Millenium..
Remember to check the website for the latest info & news on the Mini. -
British Mini Club

ronak

#27
<?php
/**********************************************************************************
* index.php                                                                       *
***********************************************************************************
* SMF: Simple Machines Forum                                                      *
* Open-Source Project Inspired by Zef Hemel ([email protected])                    *
* =============================================================================== *
* Software Version:           SMF 1.1.2                                           *
* Software by:                Simple Machines (http://www.simplemachines.org)     *
* Copyright 2006 by:          Simple Machines LLC (http://www.simplemachines.org) *
*           2001-2006 by:     Lewis Media (http://www.lewismedia.com)             *
* Support, News, Updates at:  http://www.simplemachines.org                       *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under   *
* the terms of the provided license as published by Simple Machines LLC.          *
*                                                                                 *
* This program is distributed in the hope that it is and will be useful, but      *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY    *
* or FITNESS FOR A PARTICULAR PURPOSE.                                            *
*                                                                                 *
* See the "license.txt" file for details of the Simple Machines license.          *
* The latest version can always be found at http://www.simplemachines.org.        *
**********************************************************************************/


/* This, as you have probably guessed, is the crux on which SMF functions.
Everything should start here, so all the setup and security is done
properly.  The most interesting part of this file is the action array in
the smf_main() function.  It is formatted as so:

'action-in-url' => array('Source-File.php', 'FunctionToCall'),

Then, you can access the FunctionToCall() function from Source-File.php
with the URL index.php?action=action-in-url.  Relatively simple, no?
*/

$forum_version 'SMF 1.1.2';

// Get everything started up...
define('SMF'1);
@
set_magic_quotes_runtime(0);
error_reporting(E_ALL);
$time_start microtime();

// Load the settings...
require_once(dirname(__FILE__) . '/Settings.php');

// And important includes.
require_once($sourcedir '/QueryString.php');
require_once(
$sourcedir '/Subs.php');
require_once(
$sourcedir '/Errors.php');
require_once(
$sourcedir '/Load.php');
require_once(
$sourcedir '/Security.php');

// Using an old version of PHP?
if (@version_compare(PHP_VERSION'4.2.3') != 1)
require_once($sourcedir '/Subs-Compat.php');

// If $maintenance is set specifically to 2, then we're upgrading or something.
if (!empty($maintenance) && $maintenance == 2)
db_fatal_error();

// Connect to the MySQL database.
if (empty($db_persist))
$db_connection = @mysql_connect($db_server$db_user$db_passwd);
else
$db_connection = @mysql_pconnect($db_server$db_user$db_passwd);

// Show an error if the connection couldn't be made.
if (!$db_connection || !@mysql_select_db($db_name$db_connection))
db_fatal_error();

// Load the settings from the settings table, and perform operations like optimizing.
reloadSettings();
// Clean the request variables, add slashes, etc.
cleanRequest();
$context = array();

// Determine if this is using WAP, WAP2, or imode.  Technically, we should check that wap comes before application/xhtml or text/html, but this doesn't work in practice as much as it should.
if (isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'application/vnd.wap.xhtml+xml') !== false)
$_REQUEST['wap2'] = 1;
elseif (isset(
$_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'text/vnd.wap.wml') !== false)
{
if (strpos($_SERVER['HTTP_USER_AGENT'], 'DoCoMo/') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'portalmmm/') !== false)
$_REQUEST['imode'] = 1;
else
$_REQUEST['wap'] = 1;
}

if (!
defined('WIRELESS'))
define('WIRELESS', isset($_REQUEST['wap']) || isset($_REQUEST['wap2']) || isset($_REQUEST['imode']));

// Some settings and headers are different for wireless protocols.
if (WIRELESS)
{
define('WIRELESS_PROTOCOL', isset($_REQUEST['wap']) ? 'wap' : (isset($_REQUEST['wap2']) ? 'wap2' : (isset($_REQUEST['imode']) ? 'imode' '')));

// Some cellphones can't handle output compression...
$modSettings['enableCompressedOutput'] = '0';
// !!! Do we want these hard coded?
$modSettings['defaultMaxMessages'] = 5;
$modSettings['defaultMaxTopics'] = 9;

// Wireless protocol header.
if (WIRELESS_PROTOCOL == 'wap')
header('Content-Type: text/vnd.wap.wml');
}

// Check if compressed output is enabled, supported, and not already being done.
if (!empty($modSettings['enableCompressedOutput']) && !headers_sent() && ob_get_length() == 0)
{
// If zlib is being used, turn off output compression.
if (@ini_get('zlib.output_compression') == '1' || @ini_get('output_handler') == 'ob_gzhandler' || @version_compare(PHP_VERSION'4.2.0') == -1)
$modSettings['enableCompressedOutput'] = '0';
else
ob_start('ob_gzhandler');
}
// This makes it so headers can be sent!
if (empty($modSettings['enableCompressedOutput']))
ob_start();

// Register an error handler.
set_error_handler('error_handler');

// Start the session. (assuming it hasn't already been.)
loadSession();

// What function shall we execute? (done like this for memory's sake.)
call_user_func(smf_main());

// Call obExit specially; we're coming from the main area ;).
obExit(nullnulltrue);

// The main controlling function.
function smf_main()
{
global $modSettings$settings$user_info$board$topic$maintenance$sourcedir;

// Special case: session keep-alive.
if (isset($_GET['action']) && $_GET['action'] == 'keepalive')
die;

// Load the user's cookie (or set as guest) and load their settings.
loadUserSettings();

// Load the current board's information.
loadBoard();

// Load the current theme.  (note that ?theme=1 will also work, may be used for guest theming.)
loadTheme();

// Check if the user should be disallowed access.
is_not_banned();

// Load the current user's permissions.
loadPermissions();

// Do some logging, unless this is an attachment, avatar, theme option or XML feed.
if (empty($_REQUEST['action']) || !in_array($_REQUEST['action'], array('dlattach''jsoption''.xml')))
{
// Log this user as online.
writeLog();

// Track forum statistics and hits...?
if (!empty($modSettings['hitStats']))
trackStats(array('hits' => '+'));
}

// Is the forum in maintenance mode? (doesn't apply to administrators.)
if (!empty($maintenance) && !allowedTo('admin_forum'))
{
// You can only login.... otherwise, you're getting the "maintenance mode" display.
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'login2')
{
require_once($sourcedir '/LogInOut.php');
return 'Login2';
}
// Don't even try it, sonny.
else
{
require_once($sourcedir '/Subs-Auth.php');
return 'InMaintenance';
}
}
// If guest access is off, a guest can only do one of the very few following actions.
elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('login''login2''register''register2''reminder''activate''smstats''help''.xml''verificationcode'))))
{
require_once($sourcedir '/Subs-Auth.php');
return 'KickGuest';
}
elseif (empty($_REQUEST['action']))
{
// Action and board are both empty... BoardIndex!
if (empty($board) && empty($topic))
{
require_once($sourcedir '/BoardIndex.php');
return 'BoardIndex';
}
// Topic is empty, and action is empty.... MessageIndex!
elseif (empty($topic))
{
require_once($sourcedir '/MessageIndex.php');
return 'MessageIndex';
}
// Board is not empty... topic is not empty... action is empty.. Display!
else
{
require_once($sourcedir '/Display.php');
return 'Display';
}
}

// Here's the monstrous $_REQUEST['action'] array - $_REQUEST['action'] => array($file, $function).
$actionArray = array(
'activate' => array('Register.php''Activate'),
'admin' => array('Admin.php''Admin'),
'announce' => array('Post.php''AnnounceTopic'),
'ban' => array('ManageBans.php''Ban'),
'boardrecount' => array('Admin.php''AdminBoardRecount'),
'buddy' => array('Subs-Members.php''BuddyListToggle'),
'calendar' => array('Calendar.php''CalendarMain'),
'cleanperms' => array('Admin.php''CleanupPermissions'),
'collapse' => array('Subs-Boards.php''CollapseCategory'),
'convertentities' => array('Admin.php''ConvertEntities'),
'convertutf8' => array('Admin.php''ConvertUtf8'),
'coppa' => array('Register.php''CoppaForm'),
'deletemsg' => array('RemoveTopic.php''DeleteMessage'),
'detailedversion' => array('Admin.php''VersionDetail'),
'display' => array('Display.php''Display'),
'dlattach' => array('Display.php''Download'),
'dumpdb' => array('DumpDatabase.php''DumpDatabase2'),
'editpoll' => array('Poll.php''EditPoll'),
'editpoll2' => array('Poll.php''EditPoll2'),
'featuresettings' => array('ModSettings.php''ModifyFeatureSettings'),
'featuresettings2' => array('ModSettings.php''ModifyFeatureSettings2'),
'findmember' => array('Subs-Auth.php''JSMembers'),
'help' => array('Help.php''ShowHelp'),
'helpadmin' => array('Help.php''ShowAdminHelp'),
'im' => array('PersonalMessage.php''MessageMain'),
'jsoption' => array('Themes.php''SetJavaScript'),
'jsmodify' => array('Post.php''JavaScriptModify'),
'lock' => array('LockTopic.php''LockTopic'),
'lockVoting' => array('Poll.php''LockVoting'),
'login' => array('LogInOut.php''Login'),
'login2' => array('LogInOut.php''Login2'),
'logout' => array('LogInOut.php''Logout'),
'maintain' => array('Admin.php''Maintenance'),
'manageattachments' => array('ManageAttachments.php''ManageAttachments'),
'manageboards' => array('ManageBoards.php''ManageBoards'),
'managecalendar' => array('ManageCalendar.php''ManageCalendar'),
'managesearch' => array('ManageSearch.php''ManageSearch'),
'markasread' => array('Subs-Boards.php''MarkRead'),
'membergroups' => array('ManageMembergroups.php''ModifyMembergroups'),
'mergetopics' => array('SplitTopics.php''MergeTopics'),
'mlist' => array('Memberlist.php''Memberlist'),
'modifycat' => array('ManageBoards.php''ModifyCat'),
'modifykarma' => array('Karma.php''ModifyKarma'),
'modlog' => array('Modlog.php''ViewModlog'),
'movetopic' => array('MoveTopic.php''MoveTopic'),
'movetopic2' => array('MoveTopic.php''MoveTopic2'),
'news' => array('ManageNews.php''ManageNews'),
'notify' => array('Notify.php''Notify'),
'notifyboard' => array('Notify.php''BoardNotify'),
'optimizetables' => array('Admin.php''OptimizeTables'),
'packageget' => array('PackageGet.php''PackageGet'),
'packages' => array('Packages.php''Packages'),
'permissions' => array('ManagePermissions.php''ModifyPermissions'),
'pgdownload' => array('PackageGet.php''PackageGet'),
'pm' => array('PersonalMessage.php''MessageMain'),
'post' => array('Post.php''Post'),
'post2' => array('Post.php''Post2'),
'postsettings' => array('ManagePosts.php''ManagePostSettings'),
'printpage' => array('Printpage.php''PrintTopic'),
'profile' => array('Profile.php''ModifyProfile'),
'profile2' => array('Profile.php''ModifyProfile2'),
'quotefast' => array('Post.php''QuoteFast'),
'quickmod' => array('Subs-Boards.php''QuickModeration'),
'quickmod2' => array('Subs-Boards.php''QuickModeration2'),
'recent' => array('Recent.php''RecentPosts'),
'regcenter' => array('ManageRegistration.php''RegCenter'),
'register' => array('Register.php''Register'),
'register2' => array('Register.php''Register2'),
'reminder' => array('Reminder.php''RemindMe'),
'removetopic2' => array('RemoveTopic.php''RemoveTopic2'),
'removeoldtopics2' => array('RemoveTopic.php''RemoveOldTopics2'),
'removepoll' => array('Poll.php''RemovePoll'),
'repairboards' => array('RepairBoards.php''RepairBoards'),
'reporttm' => array('SendTopic.php''ReportToModerator'),
'reports' => array('Reports.php''ReportsMain'),
'requestmembers' => array('Subs-Auth.php''RequestMembers'),
'search' => array('Search.php''PlushSearch1'),
'search2' => array('Search.php''PlushSearch2'),
'sendtopic' => array('SendTopic.php''SendTopic'),
'serversettings' => array('ManageServer.php''ModifySettings'),
'serversettings2' => array('ManageServer.php''ModifySettings2'),
'smileys' => array('ManageSmileys.php''ManageSmileys'),
'smstats' => array('Stats.php''SMStats'),
'spellcheck' => array('Subs-Post.php''SpellCheck'),
'splittopics' => array('SplitTopics.php''SplitTopics'),
'stats' => array('Stats.php''DisplayStats'),
'sticky' => array('LockTopic.php''Sticky'),
'theme' => array('Themes.php''ThemesMain'),
'trackip' => array('Profile.php''trackIP'),
'about:mozilla' => array('Karma.php''BookOfUnknown'),
'about:unknown' => array('Karma.php''BookOfUnknown'),
'unread' => array('Recent.php''UnreadTopics'),
'unreadreplies' => array('Recent.php''UnreadTopics'),
'viewErrorLog' => array('ManageErrors.php''ViewErrorLog'),
'viewmembers' => array('ManageMembers.php''ViewMembers'),
'viewprofile' => array('Profile.php''ModifyProfile'),
'verificationcode' => array('Register.php''VerificationCode'),
'vote' => array('Poll.php''Vote'),
'viewquery' => array('ViewQuery.php''ViewQuery'),
'who' => array('Who.php''Who'),
'.xml' => array('News.php''ShowXmlFeed'),
);

// Get the function and file to include - if it's not there, do the board index.
if (!isset($_REQUEST['action']) || !isset($actionArray[$_REQUEST['action']]))
{
// Catch the action with the theme?
if (!empty($settings['catch_action']))
{
require_once($sourcedir '/Themes.php');
return 'WrapAction';
}

// Fall through to the board index then...
require_once($sourcedir '/BoardIndex.php');
return 'BoardIndex';
}

// Otherwise, it was set - so let's go to that action.
require_once($sourcedir '/' $actionArray[$_REQUEST['action']][0]);
return $actionArray[$_REQUEST['action']][1];
}

?>


...........................................

This is My Index.php

what should i edit in this can anyone here tell me need to add banner Onthe Home page like

this site and even like

http://www.cricketvoice.com [nofollow]

he has added banner on the main page

i want to add 2 times on the index page and after the first post also can anyone send here the edited file

thanks
Ronak

Mod edit: Code tags

Harro

First of all it's index.template.php in your Themes folder, and not index.php
And for after the first post it's display.template.php
Read the first posts for how exactly you have to do it.

Roph

#29
Long time no see to all of you in this thread :P

I wrote up about a simple modificaiton I made to the way I display ads on my forum. Basically, logged in members are able to hide the ads for a configurable amount of time. It's a fairly long post, so I'll just link it instead:

http://slyph.org/blog/2007/06/07/smf-show-ads-to-guests-members-though-let-members-hide-them/

I hope this is of help to people :)

ham1299

Heather

Niteblade

#31
Quote from: ham1299 on June 15, 2007, 11:38:05 PM
Thanks so much! It helped tremendously! :D

Always pleased to help.

On a side note, I'm re-installing my forum, so I haven't had a chance to implement new stuff yet. Will edit first post.. 06-18-2007
affiliate blog

dripac

Forum discussing current blackhat SEO techniques, linkbait & link spamming, google adsense, yahoo answers and affiliate programs.
www.bhplanet.com

rock lee wit tits


Niteblade

Quote from: rock lee wit tits on September 07, 2007, 10:36:12 PM
all i need to know is how to make one

Make one of what? A Google ad? A template revision?

You need to apply to the adsense program @ http://www.google.com/adsense ... then, you can create and customize and ad... Google will give you that code, and per G's TOS, you cannot jack around with that code.
affiliate blog

cru

hi, i tried the part :
QuoteDisplay.template.php -- Puts adsense after EVERY first post.

in this thread's first post. but i have 2 questions.

1. i would like it to look like this, but i don't know how
http://www.sulit.com.ph/forum/viewtopic.php?t=2669&start=0

i can't seem to find the background color to blend with the default theme, coz i think its not possible to tweak a google ad that would show NO BACKGROUND.

2. i can't align it like the one shown in the link, i like the way the banner is aligned. Can u please teach me how to let it float like 100pixels to the right?

TIA!

Niteblade

Quote from: cru on September 15, 2007, 08:21:57 AM
hi, i tried the part :
QuoteDisplay.template.php -- Puts adsense after EVERY first post.

in this thread's first post. but i have 2 questions.

1. i would like it to look like this, but i don't know how
http://www.sulit.com.ph/forum/viewtopic.php?t=2669&start=0

i can't seem to find the background color to blend with the default theme, coz i think its not possible to tweak a google ad that would show NO BACKGROUND.

2. i can't align it like the one shown in the link, i like the way the banner is aligned. Can u please teach me how to let it float like 100pixels to the right?

TIA!

Some forums use an image (gradient effects) for their background. Google does not allow images to be used as backgrounds. Regarding that link you provided, did you scan thru the source of the page for the .css style?


/*
  The original subSilver Theme for phpBB version 2+
  Created by subBlue design
  http://www.subBlue.com
*/
/* General page style. The scroll bar colours only visible in IE5.5+ */
body {
background-color: #E5E5E5;
scrollbar-face-color: #DEE3E7;
scrollbar-highlight-color: #FFFFFF;
scrollbar-shadow-color: #DEE3E7;
scrollbar-3dlight-color: #D1D7DC;
scrollbar-arrow-color: #006699;
scrollbar-track-color: #EFEFEF;
scrollbar-darkshadow-color: #98AAB1;
}

/* General font families for common tags */
font,th,td,p {
font-family: Verdana, Arial, Helvetica, sans-serif
}

a:link,a:active,a:visited {
color: #006699;
}

a:hover {
text-decoration: underline;
color: #DD6900;
}

hr {
height: 0px;
border: solid #D1D7DC 0px;
border-top-width: 1px;
}

/* This is the border line & background colour round the entire page */
.bodyline {
background-color: #FFFFFF;
border: 1px #98AAB1 solid;
}

/* This is the outline round the main forum tables */
.forumline {
background-color: #FFFFFF;
border: 2px #006699 solid;
}

/* Main table cell colours and backgrounds */
td.row1 {
background-color: #EFEFEF;
}

td.row2 {
background-color: #DEE3E7;
}

td.row3 {
background-color: #D1D7DC;
}

/*
  This is for the table cell above the Topics, Post & Last posts on the index.php page
  By default this is the fading out gradiated silver background.
  However, you could replace this with a bitmap specific for each forum
*/
td.rowpic {
background-color: #FFFFFF;
background-image: url(images/cellpic2.jpg);
background-repeat: repeat-y;
}

/* Header cells - the blue and silver gradient backgrounds */
th {
color: #FFA34F;
font-size: 11px;
font-weight: bold;
background-color: #006699;
height: 25px;
background-image: url(images/cellpic3.gif);
}

td.cat,td.catHead,td.catSides,td.catLeft,td.catRight,td.catBottom {
background-image: url(images/cellpic1.gif);
background-color: #D1D7DC;
border: #FFFFFF;
border-style: solid;
height: 28px;
}

/*
  Setting additional nice inner borders for the main table cells.
  The names indicate which sides the border will be on.
  Don't worry if you don't understand this, just ignore it :-)
*/
td.cat,td.catHead,td.catBottom {
height: 29px;
border-width: 0px 0px 0px 0px;
}

th.thHead,th.thSides,th.thTop,th.thLeft,th.thRight,th.thBottom,th.thCornerL,th.thCornerR
{
font-weight: bold;
border: #FFFFFF;
border-style: solid;
height: 28px;
}

td.row3Right,td.spaceRow {
background-color: #D1D7DC;
border: #FFFFFF;
border-style: solid;
}

th.thHead,td.catHead {
font-size: 12px;
border-width: 1px 1px 0px 1px;
}

th.thSides,td.catSides,td.spaceRow {
border-width: 0px 1px 0px 1px;
}

th.thRight,td.catRight,td.row3Right {
border-width: 0px 1px 0px 0px;
}

th.thLeft,td.catLeft {
border-width: 0px 0px 0px 1px;
}

th.thBottom,td.catBottom {
border-width: 0px 1px 1px 1px;
}

th.thTop {
border-width: 1px 0px 0px 0px;
}

th.thCornerL {
border-width: 1px 0px 0px 1px;
}

th.thCornerR {
border-width: 1px 1px 0px 0px;
}

/* The largest text used in the index page title and toptic title etc. */
.maintitle,h1,h2 {
font-weight: bold;
font-size: 22px;
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
text-decoration: none;
line-height: 120%;
color: #000000;
}

/* General text */
.gen {
font-size: 12px;
}

.genmed {
font-size: 11px;
}

.gensmall {
font-size: 10px;
}

.gen,.genmed,.gensmall {
color: #000000;
}

a.gen,a.genmed,a.gensmall {
color: #006699;
text-decoration: none;
}

a.gen:hover,a.genmed:hover,a.gensmall:hover {
color: #DD6900;
text-decoration: underline;
}

/* The register, login, search etc links at the top of the page */
.mainmenu {
font-size: 11px;
color: #000000
}

a.mainmenu {
text-decoration: none;
color: #006699;
}

a.mainmenu:hover {
text-decoration: underline;
color: #DD6900;
}

/* Forum category titles */
.cattitle {
font-weight: bold;
font-size: 12px;
letter-spacing: 1px;
color: #006699
}

a.cattitle {
text-decoration: none;
color: #006699;
}

a.cattitle:hover {
text-decoration: underline;
}

/* Forum title: Text and link to the forums used in: index.php */
.forumlink {
font-weight: bold;
font-size: 12px;
color: #006699;
}

a.forumlink {
text-decoration: none;
color: #006699;
}

a.forumlink:hover {
text-decoration: underline;
color: #DD6900;
}

/* Used for the navigation text, (Page 1,2,3 etc) and the navigation bar when in a forum */
.nav {
font-weight: bold;
font-size: 11px;
color: #000000;
}

a.nav {
text-decoration: none;
color: #006699;
}

a.nav:hover {
text-decoration: underline;
}

/* titles for the topics: could specify viewed link colour too */
.topictitle {
font-weight: bold;
font-size: 11px;
color: #000000;
}

a.topictitle:link {
text-decoration: none;
color: #006699;
}

a.topictitle:visited {
text-decoration: none;
color: #5493B4;
}

a.topictitle:hover {
text-decoration: underline;
color: #DD6900;
}

/* Name of poster in viewmsg.php and viewtopic.php and other places */
.name {
font-size: 11px;
color: #000000;
}

/* Location, number of posts, post date etc */
.postdetails {
font-size: 10px;
color: #000000;
}

/* The content of the posts (body of text) */
.postbody {
font-size: 12px;
}

a.postlink:link {
text-decoration: none;
color: #006699
}

a.postlink:visited {
text-decoration: none;
color: #5493B4;
}

a.postlink:hover {
text-decoration: underline;
color: #DD6900
}

/* Quote & Code blocks */
.code {
font-family: Courier, 'Courier New', sans-serif;
font-size: 11px;
color: #006600;
background-color: #FAFAFA;
border: #D1D7DC;
border-style: solid;
border-left-width: 1px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px
}

.quote {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
color: #444444;
line-height: 125%;
background-color: #FAFAFA;
border: #D1D7DC;
border-style: solid;
border-left-width: 1px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px
}

/* Copyright and bottom info */
.copyright {
font-size: 10px;
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #444444;
letter-spacing: -1px;
}

a.copyright {
color: #444444;
text-decoration: none;
}

a.copyright:hover {
color: #000000;
text-decoration: underline;
}

/* Form elements */
input,textarea,select {
color: #000000;
font: normal 11px Verdana, Arial, Helvetica, sans-serif;
border-color: #000000;
}

/* The text input fields background colour */
input.post,textarea.post,select {
background-color: #FFFFFF;
}

input {
text-indent: 2px;
}

/* The buttons used for bbCode styling in message post */
input.button {
background-color: #EFEFEF;
color: #000000;
font-size: 11px;
font-family: Verdana, Arial, Helvetica, sans-serif;
}

/* The main submit button option */
input.mainoption {
background-color: #FAFAFA;
font-weight: bold;
}

/* None-bold submit button */
input.liteoption {
background-color: #FAFAFA;
font-weight: normal;
}

/* This is the line in the posting page which shows the rollover
  help line. This is actually a text box, but if set to be the same
  colour as the background no one will know ;)
*/
.helpline {
background-color: #DEE3E7;
border-style: none;
}

/* Import the fancy styles for IE only (NS4.x doesn't use the @import function) */
@import url("formIE.css");


Now, whenever you see a "background-color" in there, copy that over to adsense body background box... experiment with the colors outlined in the .css file in order to get advertisements that better blend in with your theme, if that's what you want.

In this case, their 728x90 banner uses this :
Quote
google_color_border = "F1F1F1";
google_color_bg = "F1F1F1";
google_color_link = "025b97";
google_color_text = "000000";
google_color_url = "000000";

Regarding banner alignment:

Surround your adsense code with
<div align="center"> ADSENSE CODE </div>.

If you want your ads to float, then use
<div style="float: left; padding-top: 5px; padding-bottom: 5px; padding-right:5px;"> ADSENSE CODE</div>

Hope that helps.
affiliate blog

SlyBaldGuy

After several experiments, I've found that the best way to control my ad delivery in my forum and across the rest of my site is to do the following:

Setup the Ad Mod in SMF
Setup OpenADS (http://www.openads.org/) on my hosting server.
Setup different zones in OpenAds for the different pages of my site AND for different areas on my form.  (ex. Top Forum, In Post, Bottom Forum, etc)
I can then paste the code for each zone in the respective Ad Mod fields for each area of the forum.

I know this sounds like overkill, but it really allows me to control the way ads are played out on the site and to experiment with various ad networks other than Adsense.

H

I moved this helpful topic to Tips and Tricks. Hopefully it will stop people asking for support in "Building your community and Other Forum Advice" while remaining useful :)
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

_Dale_

I was wondering if you could help me clear up an issue I'm having when editing the BoardIndex.template.php
It's returning
QuoteThe file you tried to save generated the following error:
Parse error: syntax error, unexpected $end in BoardIndex.template.php on line 318

Thanks a lot,

Dale.

Advertisement: