[SMF Tip] Various Ad Placements

Started by ascaland, April 22, 2011, 11:27:52 AM

Previous topic - Next topic

ayex

This below is exactly what i want to achiev. i want to add my addthis code to display below every first posts.
This is my addthis code
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a class="addthis_button_preferred_1"></a>
<a class="addthis_button_preferred_2"></a>
<a class="addthis_button_preferred_3"></a>
<a class="addthis_button_preferred_4"></a>
<a class="addthis_button_compact"></a>
<a class="addthis_counter addthis_bubble_style"></a>
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4ebe356d72f8f3b3"></script>
<!-- AddThis Button END -->

Please where do i place my addthis code for it to appear inside the post like below. I want the share button to be part of the messge body and not divided by a line away from the message body like the ad management mod did it.

ascaland

Okay, lets give this a shot then. In Display.template.php,
Code (After) Select
<div class="inner" id="msg_', $message['id'], '"', '>', $message['body'], '</div>
Code (Add) Select
' . ($message['counter'] == 0 && $context['user']['is_guest'] ? '<br /><div style="text-align: left;">
   YOUR AD CODE HERE
</div>' : '') . '


All you have to do is replace YOUR AD CODE HERE with the code snippet you provided.
Therefore, the entire code modified should look something like,
echo '
<div class="inner" id="msg_', $message['id'], '"', '>', $message['body'], '</div>
                                ' . ($message['counter'] == 0 && $context['user']['is_guest'] ? '<br /><div style="text-align: left;">
                                    YOUR AD CODE HERE
                                </div>' : '') . '
</div>';

ayex

#42
Thanks it worked on my web version but it didnt work on my wap2. i want the codes to be showing on wap2 after inside the post too. Please how do i do that?, thanks for the help

I read that if someone want to display anything both in web and wap2, then sources/display.php is to be edit?. Please Project Evolution, where will i edit in my sources/display.php to be able to place addthis button below the first post both in web and wap2. Thanks alot for your time

ascaland

Quote from: ayex on November 24, 2011, 01:09:52 PM
Thanks it worked on my web version but it didnt work on my wap2. i want the codes to be showing on wap2 after inside the post too. Please how do i do that?, thanks for the help

I read that if someone want to display anything both in web and wap2, then sources/display.php is to be edit?. Please Project Evolution, where will i edit in my sources/display.php to be able to place addthis button below the first post both in web and wap2. Thanks alot for your time

If you go to Wireless.template.php, and find the template_wap_display function, this is responsible for what is rendered to your WAP-enabled device.

If you modify something along the lines of,
echo '
<p><u>', $message['member']['name'], '</u>:', (!$message['approved'] ? '&nbsp;<em>(' . $txt['awaiting_approval'] . ')</em>' : ''), '<br /></p>
<p>', $message['body'], '<br /><br /></p>';


You can get this working. I just dont know how it would work if you added the div and script tags in there, so give it a shot.

swaggaderby

what about adding ads inside all post....?

Hj Ahmad Rasyid Hj Ismail

Quote from: Anthony` on April 22, 2011, 11:27:52 AM
  echo '
        <div class="inner" id="msg_', $message['id'], '"', '>', $message['body'], '</div>
       </div>';


Replace that with,
  echo '
        <div class="inner" id="msg_', $message['id'], '"', '>' . ($message['counter'] == 0 ? '<div style="text-align: left;">
YOUR AD CODE HERE
</div>
<br />' : '') . '', $message['body'], '</div>
       </div>';


Change the replacement code to:
  echo '
        <div class="inner" id="msg_', $message['id'], '"', '>
YOUR AD CODE HERE
</div>
<br />', $message['body'], '</div>
       </div>';

Advertisement: