News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Google AdSense in SMF, various positions...

Started by Moonray, September 25, 2005, 11:46:56 PM

Previous topic - Next topic

trenchteam

If oxygen doesnt have a display template then its using the default template.  Use that.

gulhalim

#81
I am having a littel bit of problem and hoping someone could help me out.

this is my website forum hxxp:www.matrix-network.firstclus.com/index.php?option=com_smf&Itemid=28 [nonactive] and as you see in the picture below



as you guys can see i dont know where should i add the adsese

this is my index.template.php file

<?php
// Version: 1.0; index

/* This template is, perhaps, the most important template in the theme.  It
contains the main template layer that displays the header and footer of
the forum, namely with main_above and main_below.  It also contains the
menu sub template, which appropriately displays the menu; the init sub
template, which is there to set the theme up; (init can be missing.) and
the linktree sub template, which sorts out the link tree.

The init sub template should load any data and set any hardcoded options.

The main_above sub template is what is shown above the main content, and
should contain anything that should be shown up there.

The main_below sub template, conversely, is shown after the main content.
It should probably contain the copyright statement and some other things.

The linktree sub template should display the link tree, using the data
in the $context['linktree'] variable.

The menu sub template should display all the relevant buttons the user
wants and or needs.

For more information on the templating system, please see the site at:
http://www.simplemachines.org/
*/

// Initialize the template... mainly little settings.
function template_init()
{
global $context$settings$options$txt;

/* Use images from default theme when using templates from the default theme?
if this is 'always', images from the default theme will be used.
if this is 'defaults', images from the default theme will only be used with default templates.
if this is 'never' or isn't set at all, images from the default theme will not be used. */
$settings['use_default_images'] = 'never';

/* What document type definition is being used? (for font size and other issues.)
'xhtml' for an XHTML 1.0 document type definition.
'html' for an HTML 4.01 document type definition. */
$settings['doctype'] = 'xhtml';
}

// The main sub template above the content.
function template_main_above()
{
global $context$settings$options$scripturl$txt;

// Show right to left and the character set for ease of translating.
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html'
$context['right_to_left'] ? ' dir="rtl"' '''><head>
<meta http-equiv="Content-Type" content="text/html; charset='
$context['character_set'], '" />
<meta name="description" content="'
$context['page_title'], '" />
<meta name="keywords" content="PHP, MySQL, bulletin, board, free, open, source, smf, simple, machines, forum" />
<script language="JavaScript" type="text/javascript" src="'
$settings['default_theme_url'], '/script.js"></script>
<script language="JavaScript" type="text/javascript"><!--
var smf_theme_url = "'
$settings['theme_url'], '";
var smf_images_url = "'
$settings['images_url'], '";
// --></script>
<title>'
$context['page_title'], '</title>
<link rel="stylesheet" type="text/css" href="'
$settings['theme_url'], '/style.css" />';

/* Internet Explorer 4/5 and Opera 6 just don't do font sizes properly. (they are big...)
Thus, in Internet Explorer 4, 5, and Opera 6 this will show fonts one size smaller than usual.
Note that this is affected by whether IE 6 is in standards compliance mode.. if not, it will also be big.
Standards compliance mode happens when you use xhtml... */
if ($context['browser']['needs_size_fix'])
echo '
<link rel="stylesheet" type="text/css" href="'
$settings['default_theme_url'], '/fonts-compat.css" />';

// Show all the relative links, such as help, search, contents, and the like.
echo '
<link rel="help" href="'
$scripturl'?action=help" target="_blank" />
<link rel="search" href="' 
$scripturl '?action=search" />
<link rel="contents" href="'
$scripturl'" />';

// If we're viewing a topic, these should be the previous and next topics, respectively.
if (!empty($context['current_topic']))
echo '
<link rel="prev" href="' 
$scripturl '?action=;topic=' $context['current_topic'] . '.0;prev_next=prev" />
<link rel="next" href="' 
$scripturl '?action=;topic=' $context['current_topic'] . '.0;prev_next=next" />';

// If we're in a board, or a topic for that matter, the index will be the board's index.
if (!empty($context['current_board']))
echo '
<link rel="index" href="' 
$scripturl '?action=;board=' $context['current_board'] . '.0" />';

// Output any remaining HTML headers. (from mods, maybe?)
echo $context['html_headers'], '
</head>
<body background="'
$settings['images_url'], '/box/bac.png" topmargin="5" leftmargin="5"><table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#FFFFFF">
<tr>
<td width="5">
<img border="0" src="'
$settings['images_url'], '/box/top_left.png" width="12" height="12"></td>
<td background="'
$settings['images_url'], '/box/top.png">
<img border="0" src="'
$settings['images_url'], '/box/top.png" width="3" height="12"></td>
<td width="5">
<img border="0" src="'
$settings['images_url'], '/box/top_right.png" width="14" height="12"></td>
</tr>
<tr>
<td width="5" background="'
$settings['images_url'], '/box/left.png">&nbsp;</td>
<td>'
;

// The logo, user information, news, and menu.
echo '
<table cellspacing="0" cellpadding="0" border="0" align="center" width="100%" >
<tr style="background-color: #ffffff;">
<td valign="middle" align="left">
<table border="0" cellpadding="0" cellspacing="0" width="100%" background="'
$settings['images_url'], '/bac_logo.png">
<tr>
<td>
<img border="0" src="'
$settings['images_url'], '/left_logo.png" width="462" height="88"></td>
<td width="5">
<img border="0" src="'
$settings['images_url'], '/left_icc.png" width="7" height="88"></td>
<td width="291" background="'
$settings['images_url'], '/bac_icc.png"  style="color: #FFFFFF">
'
;

// If the user is logged in, display stuff like their name, new messages, etc.
if ($context['user']['is_logged'])
{
echo '
'
$txt['hello_member'], ' <b>'$context['user']['name'], '</b>'$context['allow_pm'] ? ', ' $txt[152] . ' <a href="' $scripturl '?action=pm"  style="color: #FFFFFF">' $context['user']['messages'] . ' ' . ($context['user']['messages'] != $txt[153] : $txt[471]) . '</a>' $txt['newmessages4'] . ' ' $context['user']['unread_messages'] . ' ' . ($context['user']['unread_messages'] == $txt['newmessages0'] : $txt['newmessages1']) : '''.';

// Are there any members waiting for approval?
if (!empty($context['unapproved_members']))
echo '<br />
'
$context['unapproved_members'] == $txt['approve_thereis'] : $txt['approve_thereare'], ' <a href="'$scripturl'?action=regcenter">'$context['unapproved_members'] == $txt['approve_member'] : $context['unapproved_members'] . ' ' $txt['approve_members'], '</a> '$txt['approve_members_waiting'];

// Is the forum in maintenance mode?
if ($context['in_maintenance'] && $context['user']['is_admin'])
echo '<br />
<b>'
$txt[616], '</b>';
}
// Otherwise they're a guest - so politely ask them to register or login.
else
echo '
'
$txt['welcome_guest'];

echo '
<br />'
$context['current_time'], '
</td>
<td width="5">
<img border="0" src="'
$settings['images_url'], '/right_icc.png" width="11" height="88"></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" valign="middle" align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%" background="'
$settings['images_url'], '/bac_icon.png">
<tr>
<td width="5">
<img border="0" src="'
$settings['images_url'], '/left_icon.png" width="12" height="35"></td>
<td>'
;

// Show the menu here, according to the menu sub template.
template_menu();

echo '
</td>
<td width="5">
<img border="0" src="'
$settings['images_url'], '/right_icon.png" width="12" height="35"></td>
</tr>
</table></td>
</tr>'
;

// Show a random news item? (or you could pick one from news_lines...)
if (!empty($settings['enable_news']))
echo '
<tr>
<td colspan="2" height="24"><table border="0" cellpadding="0" cellspacing="0" width="100%" background="'
$settings['images_url'], '/bac_news.png">
<tr>
<td width="4">
<img border="0" src="'
$settings['images_url'], '/left_news.png" width="12" height="29"></td>
<td><b>'
$txt[102], ':</b> '$context['random_news_line'], '</td>
<td width="4">
<img border="0" src="'
$settings['images_url'], '/right_news.png" width="12" height="29"></td>
</tr>
</table>
</td>
</tr>'
;

echo '
</table>'
;
}

function 
template_main_below()
{
global $context$settings$options$scripturl$txt;

echo '
'
;

// Show a vB style login for quick login?
if ($context['show_vBlogin'])
echo '
<table cellspacing="0" cellpadding="0" border="0" align="center" width="100%">
<tr><td nowrap="nowrap" align="right">
<form action="'
$scripturl'?action=login2" method="post"><br />
<input type="text" name="user" size="7" />
<input type="password" name="passwrd" size="7" />
<select name="cookielength">
<option value="60">'
$txt['smf53'], '</option>
<option value="1440">'
$txt['smf47'], '</option>
<option value="10080">'
$txt['smf48'], '</option>
<option value="302400">'
$txt['smf49'], '</option>
<option value="-1" selected="selected">'
$txt['smf50'], '</option>
</select>
<input type="submit" value="'
$txt[34], '" /><br />
'
$txt['smf52'], '
</form>
</td></tr>
</table>'
;
// Don't show a login box, just a break.
else
echo '
<br />'
;

// Show the "Powered by" and "Valid" logos, as well as the copyright.  Remember, the copyright must be somewhere!
echo '
<br />

<table cellspacing="0" cellpadding="3" border="0" align="center" width="100%">
<tr>
<td width="28%" valign="middle" align="right">
<a href="http://www.mysql.com/" target="_blank"><img src="'
$settings['images_url'], '/mysql.gif" alt="'$txt['powered_by_mysql'], '" width="88" height="31" border="0" /></a>
<a href="http://www.php.net/" target="_blank"><img src="'
$settings['images_url'], '/php.gif" alt="'$txt['powered_by_php'], '" width="88" height="31" border="0" /></a>
</td>
<td width="44%" valign="middle" align="center">
'
theme_copyright(), '
<p><font size="1">Design:</font><b><a target="_blank" href="http://www.mambotemplate.ir"><font size="1">DigitalEye</font></a></b></p> </td>
<td width="28%" valign="middle" align="left">
<a href="http://validator.w3.org/check/referer" target="_blank"><img src="'
$settings['images_url'], '/valid-xhtml10.gif" alt="'$txt['valid_xhtml'], '" width="88" height="31" border="0" /></a>
<a href="http://jigsaw.w3.org/css-validator/check/referer" target="_blank"><img src="'
$settings['images_url'], '/valid-css.gif" alt="'$txt['valid_css'], '" width="88" height="31" border="0" /></a>
</td>
</tr>
</table>'
;

// Show the load time?
if ($context['show_load_time'])
echo '
<div align="center" class="smalltext">
'
$txt['smf301'], $context['load_time'], $txt['smf302'], $context['load_queries'], $txt['smf302b'], '
</div>'
;

// And then we're done!
echo '
</td>
<td width="5" background="'
$settings['images_url'], '/box/right.png">&nbsp;</td>
</tr>
<tr>
<td width="5">
<img border="0" src="'
$settings['images_url'], '/box/bot_left.png" width="12" height="12"></td>
<td background="'
$settings['images_url'], '/box/bot.png">
<img border="0" src="'
$settings['images_url'], '/box/bot.png" width="3" height="12"></td>
<td width="5">
<img border="0" src="'
$settings['images_url'], '/box/bot_right.png" width="14" height="12"></td>
</tr>
</table></body>
</html>'
;
}

// Show a linktree.  This is that thing that shows "My Community | General Category | General Discussion"..
function theme_linktree()
{
global $context$settings$options;

// Folder style or inline?  Inline has a smaller font.
echo '<span class="nav"'$settings['linktree_inline'] ? ' style="font-size: smaller;"' '''>';

// Each tree item has a URL and name.  Some may have extra_before and extra_after.
foreach ($context['linktree'] as $link_num => $tree)
{
// Show the | | |-[] Folders.
if (!$settings['linktree_inline'])
{
if ($link_num 0)
echo str_repeat('<img src="' $settings['images_url'] . '/icons/linktree_main.gif" alt="| " border="0" />'$link_num 1), '<img src="' $settings['images_url'] . '/icons/linktree_side.gif" alt="|-" border="0" />';
echo '<img src="' $settings['images_url'] . '/icons/folder_open.gif" alt="+" border="0" />&nbsp; ';
}

// Show something before the link?
if (isset($tree['extra_before']))
echo $tree['extra_before'];

// Show the link, including a URL if it should have one.
echo '<b>'$settings['linktree_link'] && isset($tree['url']) ? '<a href="' $tree['url'] . '" class="nav">' $tree['name'] . '</a>' $tree['name'], '</b>';

// Show something after the link...?
if (isset($tree['extra_after']))
echo $tree['extra_after'];

// Don't show a separator for the last one.
if ($link_num != count($context['linktree']) - 1)
echo $settings['linktree_inline'] ? ' &nbsp;|&nbsp; ' '<br />';
}

echo '</span>';
}

// Show the menu up top.  Something like [home] [help] [profile] [logout]...
function template_menu()
{
global $context$settings$options$scripturl$txt;

// Show the [home] and [help] buttons.
echo '
<a href="'
$scripturl'">', ($settings['use_image_buttons'] ? '<img src="' $settings['images_url'] . '/' $context['user']['language'] . '/home.gif" alt="' $txt[103] . '" border="0" />' $txt[103]), '</a>''
<a href="'
$scripturl'?action=help" target="_blank">', ($settings['use_image_buttons'] ? '<img src="' $settings['images_url'] . '/' $context['user']['language'] . '/help.gif" alt="' $txt[119] . '" border="0" />' $txt[119]), '</a>';

// How about the [search] button?
if ($context['allow_search'])
echo '
<a href="'
$scripturl'?action=search">', ($settings['use_image_buttons'] ? '<img src="' $settings['images_url'] . '/' $context['user']['language'] . '/search.gif" alt="' $txt[182] . '" border="0" />' $txt[182]), '</a>';

// Is the user allowed to administrate at all? ([admin])
if ($context['allow_admin'])
echo '
<a href="'
$scripturl'?action=admin">', ($settings['use_image_buttons'] ? '<img src="' $settings['images_url'] . '/' $context['user']['language'] . '/admin.gif" alt="' $txt[2] . '" border="0" />' $txt[2]), '</a>';

// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo '
<a href="'
$scripturl'?action=profile">', ($settings['use_image_buttons'] ? '<img src="' $settings['images_url'] . '/' $context['user']['language'] . '/profile.gif" alt="' $txt[79] . '" border="0" />' $txt[467]), '</a>';

// The [calendar]!
if ($context['allow_calendar'])
echo '
<a href="'
$scripturl'?action=calendar">', ($settings['use_image_buttons'] ? '<img src="' $settings['images_url'] . '/' $context['user']['language'] . '/calendar.gif" alt="' $txt['calendar24'] . '" border="0" />' $txt['calendar24']), '</a>';

// If the user is a guest, show [login] and [register] buttons.
if ($context['user']['is_guest'])
{
echo '
<a href="'
$scripturl'?action=login">', ($settings['use_image_buttons'] ? '<img src="' $settings['images_url'] . '/' $context['user']['language'] . '/login.gif" alt="' $txt[34] . '" border="0" />' $txt[34]), '</a>''
<a href="'
$scripturl'?action=register">', ($settings['use_image_buttons'] ? '<img src="' $settings['images_url'] . '/' $context['user']['language'] . '/register.gif" alt="' $txt[97] . '" border="0" />' $txt[97]), '</a>';
}
// Otherwise, they might want to [logout]...
else
echo '
<a href="'
$scripturl'?action=logout;sesc='$context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' $settings['images_url'] . '/' $context['user']['language'] . '/logout.gif" alt="' $txt[108] . '" border="0" />' $txt[108]), '</a>';
}

?>

lesmond

#82
This is how I put adsence on my test board..

This can be used with any theme :)

go to admin/Boards/Modify Boards
In the bit where is says "Full name:" put <a href="http://www.yourname.com/smf/index.php?action=forum">Advertisement</a>
this is so people cant post in the board.
then in the Description put your adsense code, thats it.

Best to 460x60 banner though :)

Demo


Free Forum Image Hosting


The only person who got all his work done by Friday was Robinson Crusoe

gulhalim

hxxp:www.matrix-network.firstclus.com/index.php?option=com_smf&Itemid=28 [nonactive]

as you can see now this is the default theme that i add the google ads code and i want it the same for the other theme.and thanks for the tip lesmond

Vinspire

Quote from: gulhalim on May 17, 2006, 01:46:09 AM
http://www.matrix-network.firstclus.com/index.php?option=com_smf&Itemid=28

as you can see now this is the default theme that i add the google ads code and i want it the same for the other theme.and thanks for the tip lesmond

Ermm ... How do you add that in default theme ? There is a few codes lying around this thread. Which one should i follow ?

Miyagi

This is a little off to the side of the topic at hand.

For those having trouble trawling through coding to get ads on your site, i'd suggest trying out TinyPortal and using the block functionality to easily and effectively add various code.

As an example my site i have a center block up top with my 468x60 banner code simply cut and paste into it. I also have the skyscraper down the LHS in a block. It made it very easy for me to do... TinyPortal is sweeet!  ;D
FordXR5Turbo.com - Dedicated to the Ford Focus & Mondeo XR5 Turbo in Australia
FordXR4.com - Dedicated to the Ford Fiesta XR4 in Australia

Vinspire

I am using SMF 1.1 RC 2

Theme : Default

Tried the 1st guide - Manage to get it working

Anyway, my question is ... how to do this ?



And whats the code to do this "google ads" between "menu bar" & "forum"

http://www.matrix-network.firstclus.com/index.php?option=com_smf&Itemid=28

trenchteam

Try some CSS.  I got it working on my www.shoyoroll.com/forum site.   I cant really give you directions because its a very rough coding.  Anyway, try CSS and google putting images in absolute sections of a webspace.  I did that and managed to get it to work. 

MeetHere

Hello, as per first post i have placed the google adsense codes on the smf 1.1 RC2 version of my forum..

But i am getting some n m z links on the right top of the google ad placed just below the top logo.

also second code shows ads above the first post..

You can view my forum : hxxp:meethere.org [nonactive]

Also help me to place adsense ads on the top right corner and at the bottom of the page..

Please help me in getting out of this problem..


perlisbetter

I don't like PHP, I prefer the stability of Perl better but I have a question.

My code deliveres a parsing error and it's probably due the to echo ' and my printout having ' in it. What's the escape characterr I should use?

Or is there another way to do the echo where I wouldn't have to?

Ie:

print " \" \" ";
print " ' ' ";
print qq( "" '' " ');

in Perl?

Charles LePage

Quote from: geezmo on April 22, 2006, 06:38:55 AM
I have the same problem. Adsense is on top-left of the first post not under it. And there's no "dummy poster" aka "Sponsored Links."

I'm using 1.07 and having the same issue.

Bigguy

Why not use the ad mod. Would that not be easier than this. PLus it gives you more options on were to put the ads.

Charles LePage

Sounds cool... where do I find this "ad mod?"

Bigguy


Charles LePage

Thank you!

I noticed one of the comments on the ad mod was that it only worked on the default theme... is that accurate?

Bigguy

No it works on all themes but you have to do the edits to other themes other than the default theme yourself. So, you install the ad mod on the default theme, then go to the theme folder that you are using and edit the template files manually. You can find all the edits in the "install.xml" file or at this website:

http://www.smfads.com/forums/index.php?board=7.0


Bigguy


Charles LePage

I've posted some questions for you here on your forum:

http://www.smfads.com/forums/index.php?topic=118.0

Thank you for all the information you've provided!

Bigguy

Answered, sorry about the wait.

Quote from: Charles LePage on August 09, 2006, 01:37:39 PM
I've posted some questions for you here on your forum:

http://www.smfads.com/forums/index.php?topic=118.0

Thank you for all the information you've provided!

Advertisement: