Customizing SMF > Tips and Tricks

Google AdSense in SMF, various positions...

<< < (75/76) > >>

piranon:
Thanks for your sharing.

bukharifaran:
Hi,

I've tried to add the google ad code in first Post. Though my Display.template.php file code is bit different from the code which is provided by topic initiator, but I've successfully added the code with a little variation.

The area of Display.template.php file was mentioned by topic initiator had a different code, my code at that place was as follow:


--- Code: ---// Show the member's signature?
if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled'])
echo '
<div class="signature" id="msg_', $message['id'], '_signature">', $message['member']['signature'], '</div>';

echo '
</div>
</div>
<span class="botslice"><span></span></span>
</div>
<hr class="post_separator" />';
}
--- End code ---

I have added the code provided by topic initiator after replacing my adsense code after:


--- Code: ---// Show the member's signature?
if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled'])
echo '
<div class="signature" id="msg_', $message['id'], '_signature">', $message['member']['signature'], '</div>';
--- End code ---

So if anyone have different code in Display.template.php file and it matches with the code I've provided above, he can add his google ad code after above lines which I've mentioned.

Here you can see the result.
http://www.mobilefun.pk/forum/topic-9.0.html

bukharifaran:
After adding the google code in First post of each topic as described by the topic initiator, I've also added the google ad code on the second place. Just below the Main menu as we have on SMF http://www.simplemachines.org/community/index.php

Topi initiator mention index.template.php file to edit. But he is using some different theme. Where as I am using default theme. By adding the code provided by topic initiator, it creates some table and other links along with google ad which looks bad.

Topic initiator give this line to search:

--- Code: ---// The main content should go here.
--- End code ---
(Some more text was there in initial posts but that text is not in default theme.)

Topic initiator mention to add his provided code below above mentioned line.

But if you are using default template than right below this line, you will find this code:


--- Code: ---echo '
<div id="content_section"><div class="frame">
<div id="main_content_section">';

// Custom banners and shoutboxes should be placed here, before the linktree.

--- End code ---

I have added my Google code right after the second dive having id="main_content_section" and it works fine for me. You have to add like this:


--- Code: ---echo '
<div id="content_section"><div class="frame">
<div id="main_content_section">

Your Google Ad code here
 ';

// Custom banners and shoutboxes should be placed here, before the linktree.

--- End code ---

And it will work for you.

:)

ahrasis:
The OP was created long time ago bukharifaran. Don't expect the code will remain the same. :P

bukharifaran:

--- Quote from: No More Mr Nice Sully on October 22, 2012, 07:47:30 PM ---The OP was created long time ago bukharifaran. Don't expect the code will remain the same. :P

--- End quote ---

I know that there will be many users like me who are new and they might have the exact code that I have. So my post can help them in selecting a right place to insert the code.

When I ask from support how to add google ads, they told me to browse the TIPS and Tricks category. I open this and found this thread. And I see some posts where users are complaining that there code is different from the one provided in first post. That is why I posted the new code which I have.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version