News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Google AdSense in SMF, various positions...

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

Previous topic - Next topic

badmasketa


View full-size image here: http://i36.tinypic.com/2nuhxz6.jpg

I wanna put the GOOGLE ADSENSE in Babylon Theme like the way i have drawn in the screenshot above...

how's that possible??
any idea?


bintua

I am still having problems with putting google ad sense on my site. I was able to put it on the footer but i want to see it in every posts i have please help. Thanks
I have 1.1.6  installed

anakmacan

Theme : Classic YABB
Version : 1.1.5

Question :
How do i insert advertisement in the middle of text in first post like this?



Ive downloaded smf Ad Management, but i cant make it to be exactly like i want as in picture above.  I appreciate your help in advance :) (and show me your site ill click your ads for you ).

dazea2k8

It doesn't work on all themes, well it doesn't work for me  ;)

Rumbaar

There is a feature of the Ads Management mod to insert into the first message of a thread?  If so then, and it's not in the desired position, you'll need edit the Display or Post templates that the ads management mod adds the code too and position it how you want.

Also any code should work in all themes, as long as you make the changes to all custom themes applicable template files.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

Bananas92

#186
I'm add google ads by iGraphiX and have problem :/ My theme is Xbox360_Elite, table, images after install crazy position, pls look  on hxxp:www.gtamods.pl/forum2/index.php?topic=1.0 [nonactive]. Pleas help me.

delniotis

Quote
2. To display AdSense unit after the first post:

Find this code:

// 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>';


And right after it add this code:

//Google Adsense
if ($message['id'] == $context['first_message'])
   echo '
   <tr><td style="padding: 1px 1px 0 1px;">
   <table width="100%" cellpadding="3" cellspacing="0" border="0">
   <tr><td class="windowbg">
   <div align="center">
<script type="text/javascript"><!--
google_ad_client = "pub-YOUR_ADSENSE";
/* blog_bottom */
google_ad_slot = "6779400012";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
   </div>
   </td></tr></table></td></tr>';
//End of Google Adsense


PS. Don't forget to insert your Publisher ID fron AdSense :)


Wow, thanks this works fine, but how can we place the ads before the members signature ?
(between post/text and the signature) all this in the first post, not as second post


Oldiesmann

Add the ad code before the specified code instead of after it :)
Michael Eshom
Christian Metal Fans

llckll

Quote from: badmasketa on September 24, 2008, 01:13:21 PM

View full-size image here: http://i36.tinypic.com/2nuhxz6.jpg [nofollow]

I wanna put the GOOGLE ADSENSE in Babylon Theme like the way i have drawn in the screenshot above...

how's that possible??
any idea?

I would like to add the same google ads all the way to the right of the forum sections.  Where in the code do I add that?

Thanks.

mrzaheri

Thank you iGraphiX,
I did what ever you said but the google adsense dose not appear in the posts. Actually an empty area is appeared based on my adsense size but it is empty.
P.S : I have used my own created adsense ads.  I have used it before in my header.
also I am using babylon theme:
www.irandspcenter.ir/forum1
Does it need any change in other files?


L'AltroWeb

#191
Hi!
Sorry but i don't have read all posts from this topic.
Info from first post don't works for me.
I've edit like this and now is ok ;)

	
	
// 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>';
   if (
$message['id'] == $context['first_message'])
       echo 
'
        <div style="text-align: center; padding: 10px;">
        <banner code>
        </div>'
;
	
	
echo 
'
	
	
	
	
	
	
</td>
	
	
	
	
	
</tr>
	
	
	
	
</table>
	
	
	
</td></tr>
	
	
</table>
	
</td></tr>'
;
	
}

-
Demo here: http://darkwolf.altervista.org/forum/modemrouter/d-link-dsl-2640b-brikkato/msg2039/#msg2039  :)

BellyDanceDreams

I can't figure where to put the code on the 1.1.8 version.  I want ad it on all my pages but when I add my code I get this on my forum:

Template Parse Error!
It seems something has gone sour on the forum with the template system. This problem should only be temporary, so please come back later and try again. If you continue to see this message, please contact the administrator.

You can also try refreshing this page.
Erina Medine

BellyDanceDreams

Quote from: iGraphiX on September 13, 2008, 03:13:57 AM
Hi lads, this is a way too long post, and I was wondering if I can make it longer. Hehe, just kidding.
I'm a noob but I hope this helps:


View full-size image here: http://i37.tinypic.com/n2dcvq.png

I'm using SMF 1.1.6.
In order to see what's in the screenshot you have to do the following modifications in the default theme folder, file to edit: Display.template.php

1. For the top of post ad unit:

Find this code:

// Now show how many guests are here too.
echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_topic'], '
</td>
</tr>';
}

echo '
</table>';


And right after it add:

//Google Adsense
   echo '
   <tr><td style="padding: 1px 1px 0 1px;">
   <table width="100%" cellpadding="3" cellspacing="0" border="0">
   <tr><td class="windowbg">
   <div align="center">
<script type="text/javascript"><!--
google_ad_client = "pub-YOUR_ADSENSE";
/* blog_bottom */
google_ad_slot = "6779400012";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
   </div>
   </td></tr></table></td></tr>';
//End of Google Adsense


2. To display AdSense unit after the first post:

Find this code:

// 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>';


And right after it add this code:

//Google Adsense
if ($message['id'] == $context['first_message'])
   echo '
   <tr><td style="padding: 1px 1px 0 1px;">
   <table width="100%" cellpadding="3" cellspacing="0" border="0">
   <tr><td class="windowbg">
   <div align="center">
<script type="text/javascript"><!--
google_ad_client = "pub-YOUR_ADSENSE";
/* blog_bottom */
google_ad_slot = "6779400012";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
   </div>
   </td></tr></table></td></tr>';
//End of Google Adsense


Now it easy to understand that in order to correctly display Google AdSense units in any version of SMF forums, in any position or alignment, just see this code and place it where you think it might bring some impressions:

   
//Start Google Adsense   
echo '
   <tr><td style="padding: 1px 1px 0 1px;">
   <table width="100%" cellpadding="3" cellspacing="0" border="0">
   <tr><td class="windowbg">
   <div align="center">
<script type="text/javascript"><!--
google_ad_client = "pub-YOUR_ADSENSE";
/* blog_bottom */
google_ad_slot = "6779400012";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
   </div>
   </td></tr></table></td></tr>';
//End of Google Adsense


PS. Don't forget to insert your Publisher ID fron AdSense :)


now, I have used the first code and it works, however it keeps trying to log me out when I try reply to posts!  ???
Erina Medine

Sarge

Quote from: BellyDanceDreams on April 10, 2009, 12:44:59 PM
now, I have used the first code and it works, however it keeps trying to log me out when I try reply to posts!  ???

Do you see an error message on the page? Or in the error log?

    Please do not PM me with support requests unless I invite you to.

http://www.zeriyt.com/   ~   http://www.galeriashqiptare.net/


Quote
<H> I had zero posts when I started posting

BellyDanceDreams

Quote from: Sarge on May 08, 2009, 01:45:49 AM
Quote from: BellyDanceDreams on April 10, 2009, 12:44:59 PM
now, I have used the first code and it works, however it keeps trying to log me out when I try reply to posts!  ???

Do you see an error message on the page? Or in the error log?
Nope it just logged me straight out!
Erina Medine

Sarge

Quote from: BellyDanceDreams on May 08, 2009, 06:15:57 AM
Nope it just logged me straight out!

Does it happen as an admin or as a regular user? What's your forum URL?

    Please do not PM me with support requests unless I invite you to.

http://www.zeriyt.com/   ~   http://www.galeriashqiptare.net/


Quote
<H> I had zero posts when I started posting

BellyDanceDreams

Quote from: Sarge on May 08, 2009, 06:44:11 AM
Quote from: BellyDanceDreams on May 08, 2009, 06:15:57 AM
Nope it just logged me straight out!

Does it happen as an admin or as a regular user? What's your forum URL?
Admin
www.bellydancedreams.co.uk/forums
Erina Medine

saibaworld

Which is better to use in placing adsense or other affiliate codes in my forum: ad mod OR editing my templates?

I ask cos of problem of updates and other tech issues wich may come up with an ad mod? At the same time, i tried editing my templates and had a virus contaminate my forum (see http://www.simplemachines.org/community/index.php?topic=310921.0)

Wich is better pls?
"The magician and the politician have much in common: they both have to draw our attention away from what they are really doing." - Ben Okri
"The one being carried does not realize how far away the town is." - Nigerian proverb

ANF Forum  ||  Study & Scholarships || Jobs & Careers || The Internist

dzinerfusion

Sorry if this is really a noob question but the codes you put, are they compatible with 2.0 rc1?

Advertisement: