News:

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

Main Menu

Checking stickies in messageindex

Started by Elmacik, December 13, 2005, 03:09:24 PM

Previous topic - Next topic

Elmacik

How to check and act according to that if there is/are sticky topic(s) in a board?
For example I want to make a picture display above and below the stickies..
So when there is/are sticky topic(s) it will display, when there isnt/arent, it wont.

Please note: I am NOT asking how to seperate stickies/normal posts.

One another question: When adding a button to post template, is there an extra work to highlight it like others? My buttons didnt auto highlight (mouseover)
Home of Elmacik

Thantos

File:  MessageIndex.template.php
Find:

                
foreach ($context['topics'] as $topic)
                {
                        // Do we want to seperate the sticky and lock status out?
                        if (!empty($settings['seperate_sticky_lock']) && strpos($topic['class'], 'sticky') !== false)
                                $topic['class'] = substr($topic['class'], 0strrpos($topic['class'], '_sticky'));
                        if (!empty($settings['seperate_sticky_lock']) && strpos($topic['class'], 'locked') !== false)
                                $topic['class'] = substr($topic['class'], 0strrpos($topic['class'], '_locked'));



Replace with

                $isSticky 
false;
                foreach ($context['topics'] as $topic)
                {
                        // Do we want to seperate the sticky and lock status out?
                        if (!empty($settings['seperate_sticky_lock']) && strpos($topic['class'], 'sticky') !== false)
                                $topic['class'] = substr($topic['class'], 0strrpos($topic['class'], '_sticky'));
                        if (!empty($settings['seperate_sticky_lock']) && strpos($topic['class'], 'locked') !== false)
                                $topic['class'] = substr($topic['class'], 0strrpos($topic['class'], '_locked'));

                        if ( !$isSticky && $topic['is_sticky'] )
                        {
                                $isSticky = !$isSticky;
                                echo '
                                        Above Code Here'
;
                        }

                        if ( $isSticky && !$topic['is_sticky'] )
                        {
                                $isSticky = !$isSticky;
                                echo '
                                        Below Code Here'
;
                        }

Elmacik

MikeMill, you always do that and give the codes of un-released versions :P
Thanks though, you are still great ;D
Home of Elmacik

Thantos

Its because of my future seeing abilities :)

Though I think the basic structure is the same

Advertisement: