TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,019
  • Total Topics: 21,332
  • Online today: 1,232
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 543
  • Total: 544
  • @rjen

Custom banner integration

Started by Jeff, June 20, 2005, 03:06:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jeff

Bloc, I'm placing this question here vice on the SMF forum because I think it would have to be done in the theme.

How would I go about integrating banners into the forum theme within the threads? 

Right now I have banners at the top, but would LOVE to integrate them into the threads.  For instance, when you bring up a forum board and have the list of threads, after say 10 threads are listed, a banner could be inserted, then 10 more threads.

If you don't understand what I'm asking, take a look at www.rv.net/forum and how they run classifieds just as I've stated here.

Thanks!

(also upgraded to 1.4 over the weekend with no malfunctions in helios_multi)

Bjørn

Interesting. :) I would probably set up a counter and when it hits 10 or something, render a row with the banner in it instead, then just continue the next row with additional threads, resetting the counter too.

It should not be a lot of code if you keep it simple..with perhaps direct links to banner for example.Or just use a "include" for a file with the link in it. So you can rotate it. It depends on how many banners you have and if they should rotate on each pageview.

Is it the Helios Multi theme you are thinking of adding it to?

Jeff

The banner code itself is multiple lines of code:

============================================
<script language="JavaScript" type="text/javascript" src="http://www.cbr600rr.com/phpAdsNew-2.0.3/adx.js"></script>
   <script language="JavaScript" type="text/javascript">
   <!--
   if (!document.phpAds_used) document.phpAds_used = ",";
   phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);

   document.write ("<" + "script language=\"JavaScript\" type=\"text/javascript\" src=\"");
   document.write ("http://www.cbr600rr.com/phpAdsNew-2.0.3/adjs.php?n=" + phpAds_random);
   document.write ("&amp;what=zone:1&amp;withText=1");
   document.write ("&amp;exclude=" + document.phpAds_used);
   if (document.referrer)
   document.write ("&amp;referer=" + escape(document.referrer));
   document.write ("\"><" + "/script>");
   //-->
   </script><noscript><a href="http://www.cbr600rr.com/phpAdsNew-2.0.3/adclick.php?n=a6551bee" target="_blank"><img src="http://www.cbr600rr.com/phpAdsNew-2.0.3/adview.php?what=zone:1&amp;n=a6551bee" border="0" alt=""></a></noscript>

============================================

My primary interest is helios_multi as that's what I'm using on 3 out of 5 forums right now, but understanding how its done would allow me to adapt it to other themes as well.

That said, I have very little experience in PHP coding.  I have managed to labor thorugh getting the banner code working correctly in multiple themes, and modifying certain things (adding buttons, etc - before the convenience of helios_multi).

If you're up for lending a hand, I'd LOVE to make it work.  I could probably pay you a bit for it, or just shout from my rooftop that you're super cool... :)

Bjørn

"super cool" sounds nice.. ;D

ok, to do this you need first to intercept the rendering of the rows in MessageIndex.template.php. i use Helios, but its nearly the same in all themes, they tend to leave that bit alone. :)

find this code part:
        foreach ($context['topics'] as $topic)
        {
                echo '
                                <tr>
                                        <td class="windowbg2" valign="middle" align="center" width="5%">
                                                <img src="', $settings['images_url'], '/topic/', $topic['class'], '.gif" alt="" />
                                        </td>
                                        <td class="windowbg2" valign="middle" align="center" width="4%">
                                                <img src="', $settings['images_url'], '/post/', $topic['first_post']['icon'], '.gif" alt="" />
                                        </td>
                                        <td class="windowbg" valign="middle">
                                                ', $topic['first_post']['link'];


And replace with this:

        $mycount=0;
        foreach ($context['topics'] as $topic)
        {
                 // increase the counter...
                $mycount++;

                // max threads = 10 before banner
                if($mycount==10){
                    echo '<tr><td align="center" class="windowbg2" colspan="', (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics'])) ? '8' : '7' , '">';
                    echo '
<script language="JavaScript" type="text/javascript" src="http://www.cbr600rr.com/phpAdsNew-2.0.3/adx.js"></script>
        <script language="JavaScript" type="text/javascript">
        <!--
        if (!document.phpAds_used) document.phpAds_used = ",";
        phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);

        document.write ("<" + "script language=\"JavaScript\" type=\"text/javascript\" src=\"");
        document.write ("http://www.cbr600rr.com/phpAdsNew-2.0.3/adjs.php?n=" + phpAds_random);
        document.write ("&amp;what=zone:1&amp;withText=1");
        document.write ("&amp;exclude=" + document.phpAds_used);
        if (document.referrer)
        document.write ("&amp;referer=" + escape(document.referrer));
        document.write ("\"><" + "/script>");
        //-->
        </script><noscript><a href="http://www.cbr600rr.com/phpAdsNew-2.0.3/adclick.php?n=a6551bee" target="_blank"><img src="http://www.cbr600rr.com/phpAdsNew-2.0.3/adview.php?what=zone:1&amp;n=a6551bee" border="0" alt=""></a></noscript>
                    ';
                    echo '</td></tr>';

                    // reset the counter
                    $mycount=0;
                }
                echo '
                                <tr>
                                        <td class="windowbg2" valign="middle" align="center" width="5%">
                                                <img src="', $settings['images_url'], '/topic/', $topic['class'], '.gif" alt="" />
                                        </td>
                                        <td class="windowbg2" valign="middle" align="center" width="4%">
                                                <img src="', $settings['images_url'], '/post/', $topic['first_post']['icon'], '.gif" alt="" />
                                        </td>
                                        <td class="windowbg" valign="middle">
                                                ', $topic['first_post']['link'];


i have tested it , and it should work fine. As you can see I have just intercepted before the actual topics rendering to check whether the counter is 10 already - then output the code. And it will repeat that again further down, if the topics display allow more (more than 20 threads).

Jeff

You're awesome Bloc!

I'll give this a whirl on my test box tonight and if good I'll put it into production.

Thanks again.  I'll let you know how it goes.

Jeff

Absolutely fantastic.

Actually, I played with the code a bit and have the banner sitting after 5 messages, but removed the counter reset, so only 1 banner shows. 

Very nice indeed...  I think I'll probably play with it some more.  Right now with the way I have banners, I don't really want to draw back 2 banners per page because it'll suck up bandwidth and slow things down.  There's a pretty good share of traffic there, but I may start running smaller banners which would allow me to run a second zone and have smaller banners in one spot and the larger ones in another.

Here's the site where I made the change:
www.cbr600rr.com/forum

Thanks again Bloc. You are indeed "Super Cool" 

Ciinien

I've been thinking about doing something akin to this as well.

However, I want to put the banners just under the member's pic and stats, in that page-refreshed news block. Since I have the News fader for actual site news (which is a feature I really like about Helios), I thought I might put banners in the top one to help subsidize the site at some point when it becomes useful enough to people for them to wish to donate. I don't need a timer to change them or anything, there would simply be a different banner shown each time the page refreshes, exactly as the news works there now. I will toy around with the code later and see if I can substitute banner images instead of text news.

And yes, that's a very nice feature there, Jeff, and a great site if I were into bikes anymore. Had a '69 Sportster, XLCH I think it was, back in '74. After a lady pulled out in front of me and I totaled it, I've never owned another... ;P

Cheers!
Ci

Gargoyle

You need to box that code up... It worked great!! Thanks!!

This website is proudly hosted on Crocweb Cloud Website Hosting.