Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: Alexandre P. on September 05, 2004, 06:23:54 PM

Title: Separating the sticky topics from the normal ones
Post by: Alexandre P. on September 05, 2004, 06:23:54 PM
Hi,

I would like to know how to separate the sticky topics from the rest of the normal topics.  Like what you could see on this IPB-powered board (http://www.webdynamit.net/forum/index.php?showforum=13) or this PhpBB-powered board (http://www.im-l.com/forum/viewforum.php?f=5): the sticky topics are separated from the normal ones.

I believe this modification should be made in MessageIndex.template.php, around line 126 or 156, but I don't know how to determine if a topic is sticky or normal :-\

Thanks all :)
Title: Re: Separating the sticky topics grom the normal ones
Post by: [Unknown] on September 05, 2004, 06:37:07 PM
I remember telling Owdy how to do this one.  Where did that topic go?

-[Unknown]
Title: Re: Separating the sticky topics grom the normal ones
Post by: Ben_S on September 05, 2004, 06:37:36 PM
Tips and tricks I beleive.

Well it did, but now the topic is in the bin ???

MessageIndex.template.php

Find
foreach($context['topics'] as $topic)
{


Replace With

$stickybar = false;
$normalbar = false;
foreach($context['topics'] as $topic)
{
if($topic['is_sticky'] && !$stickybar)
{
echo'<tr class="titlebg"><td colspan="', empty($options['display_quick_mod']) ? '7' : '8', '"><b>Important Topics</b></td></tr>';
$stickybar = true;
}
else if(!$topic['is_sticky'] && $stickybar && !$normalbar)
{
echo'<tr class="titlebg"><td colspan="', empty($options['display_quick_mod']) ? '7' : '8', '"><b>Normal Topics</b></td></tr>';
$normalbar = true;
}


I take no credit for that, just a copy and paste.
Title: Re: Separating the sticky topics grom the normal ones
Post by: 127.0.0.1 on September 05, 2004, 07:05:20 PM
I accomplished the same thing on my board differently with less code (my method probably sucks).

Find:


foreach ($context['topics'] as $topic)
{



Add after:


if (isset($previousTopicClass))
echo (ereg("sticky", $previousTopicClass) && !ereg("sticky", $topic['class'])) ? '
<tr>
<td>&nbsp;</td>
<td colspan="5">' . $txt[70] . '</td>
</tr>' : '';

$previousTopicClass = $topic['class'];
Title: Re: Separating the sticky topics grom the normal ones
Post by: [Unknown] on September 05, 2004, 07:18:19 PM
I would make it:

if (isset($previousTopicClass) && strpos($previousTopicClass, 'sticky') !== false && !$topic['is_sticky'])
echo '
<tr>
<td>&nbsp;</td>
<td colspan="5">' . $txt[70] . '</td>
</tr>';
$previousTopicClass = $topic['class'];


-[Unknown]
Title: Re: Separating the sticky topics grom the normal ones
Post by: Alexandre P. on September 05, 2004, 09:45:02 PM
This is just excellent :D  Thanks all !
Title: Re: Separating the sticky topics from the normal ones
Post by: TarantinoArchives on September 07, 2004, 02:02:54 PM
I think the second solution doesnt look very elegant. The first one seems to be more into what the idea behind this is, to mark those "important" and all.

somehow, when i tried out the first solution, it gives me a parsing error and something about single quotes and all. could somebody in here check this one and maybe post a better solution, that would be very nice. I think this should actually be part of SMF as an admin option, kinda like "enable seperating of sticky topics" or something like that
Title: Re: Separating the sticky topics from the normal ones
Post by: TarantinoArchives on September 07, 2004, 03:33:12 PM
ah well, here's what i did now:

Quote
if (isset($previousTopicClass) && strpos($previousTopicClass, 'sticky') !== false && !$topic['is_sticky'])
      echo '
         <tr class="titlebg">
         <td colspan="2">&nbsp;</td>
         <td colspan="7">&nbsp;</td>
         </tr>';
$previousTopicClass = $topic['class'];

basically, the sedong TD can have some title like "normal topics", the first TD is just to align it. I added the TR class to have the bar in the same CSS style
Title: Re: Separating the sticky topics from the normal ones
Post by: evolus on September 08, 2004, 09:09:45 AM
Thanx all, that was for me :)
Title: Seperating Stickys From Normal Topics
Post by: ~Tyris~ on September 27, 2004, 04:36:47 PM
Awhile ago this script was posted... but i cant find it now it would be nice to use it to make things look neater; was just wondering if the code could be re-posted? thanks! :)
Title: Re: Seperating Stickys From Normal Topics
Post by: Ben_S on September 27, 2004, 04:39:53 PM
http://www.simplemachines.org/community/index.php?topic=16265.0
Title: Re: Separating the sticky topics from the normal ones
Post by: A.M.A on September 27, 2004, 05:35:57 PM
merged topics ..
Title: Re: Separating the sticky topics from the normal ones
Post by: Wolfden on September 29, 2004, 10:34:08 PM
can someone clarify this file name tho?  MessageIndex.template.php   - I'm not finding a template.php
Title: Re: Separating the sticky topics from the normal ones
Post by: Wolfden on September 29, 2004, 10:59:43 PM
ahhh I found it, taking me a bit to get use to the smf file system
Title: Re: Separating the sticky topics from the normal ones
Post by: SilentNoise on October 01, 2004, 03:08:49 AM
Quote from: TarantinoArchives on September 07, 2004, 03:33:12 PM
ah well, here's what i did now:

Quote
if (isset($previousTopicClass) && strpos($previousTopicClass, 'sticky') !== false && !$topic['is_sticky'])
      echo '
         <tr class="titlebg">
         <td colspan="2">&nbsp;</td>
         <td colspan="7">&nbsp;</td>
         </tr>';
$previousTopicClass = $topic['class'];

basically, the sedong TD can have some title like "normal topics", the first TD is just to align it. I added the TR class to have the bar in the same CSS style

This is exactly what I was looking for, except for one thing... I was hoping to make that bar about 1/2 the height. Is there any way to change this?
Title: Re: Separating the sticky topics from the normal ones
Post by: [Unknown] on October 01, 2004, 03:10:10 AM

if (isset($previousTopicClass) && strpos($previousTopicClass, 'sticky') !== false && !$topic['is_sticky'])
echo '
<tr class="titlebg" style="font-size: 1ex;">
<td colspan="2">&nbsp;</td>
<td colspan="7">&nbsp;</td>
</tr>';
$previousTopicClass = $topic['class'];


-[Unknown]
Title: Re: Separating the sticky topics from the normal ones
Post by: SilentNoise on October 01, 2004, 03:25:44 AM
That didn't do anything to shrink the height of the seperator line. ???

TarantinoArchives' board shows the size that I'm roughly looking for: http://tarantino.loucreative.de/forum/index.php?PHPSESSID=480e0db079a06cab594c0b26163b269b&board=4.0
Title: Re: Separating the sticky topics from the normal ones
Post by: [Unknown] on October 01, 2004, 03:38:41 AM
Try removing the &nbsp; parts.

-[Unknown]
Title: Re: Separating the sticky topics from the normal ones
Post by: SilentNoise on October 01, 2004, 03:49:06 AM
oh ya.... I'm tired, and should go to bed.

Thanks again guys
Title: Re: Separating the sticky topics from the normal ones
Post by: Nederland on November 01, 2004, 08:38:14 AM
I'll try to use this trick, thanks guys!!
Title: Re: Separating the sticky topics from the normal ones
Post by: diplomat. on November 01, 2004, 09:00:16 AM
i put it on my board also. looks nice :D
Title: Re: Separating the sticky topics from the normal ones
Post by: Villesa on November 01, 2004, 09:19:39 AM
Diplomat: You might want to upgrade so SMF RC2 ?
Title: Re: Separating the sticky topics from the normal ones
Post by: diplomat. on November 01, 2004, 09:47:12 AM
i was thinking of waiting til 1.0 final to upgrade, unless thats not a wise thing to do ???
Title: Re: Separating the sticky topics from the normal ones
Post by: Chris G. on November 21, 2004, 10:22:16 PM
Wow.  Nice work!
Title: Re: Separating the sticky topics from the normal ones
Post by: gerrymore on December 14, 2004, 07:36:11 AM
Cool, worked a treat.

Thanx

8)
Title: Re: Separating the sticky topics from the normal ones
Post by: dwayne on December 22, 2004, 01:13:54 AM
cant seem to find messageindex.template.php
Title: Re: Separating the sticky topics from the normal ones
Post by: CapriSkye on December 22, 2004, 01:24:55 AM
it should be in your template folder
Title: Re: Separating the sticky topics from the normal ones
Post by: TarantinoArchives on December 31, 2004, 07:38:15 AM
Quote
if (isset($previousTopicClass) && strpos($previousTopicClass, 'sticky') !== false && !$topic['is_sticky'])
      echo '
         <tr class="titlebg">
         <td colspan="2">&nbsp;</td>
         <td colspan="7">&nbsp;</td>
         </tr>';
$previousTopicClass = $topic['class'];

why do I get a template parsing error when using this in SMF 1.0 final now? can somebody from the SMF crew check if this actually works with the replace routine posted above?
Title: Re: Separating the sticky topics from the normal ones
Post by: [Unknown] on December 31, 2004, 07:49:31 AM
Can you post three lines above and below where you're putting that code, please?

-[Unknown]
Title: Re: Separating the sticky topics from the normal ones
Post by: TarantinoArchives on December 31, 2004, 07:58:38 AM
Quote
// No topics.... just say, "sorry bub".
   else
      echo '
               <td width="100%" colspan="7"><b>', $txt[151], '</b></td>';

   echo '
            </tr>';

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

i replace the bold text with what was suggested in this topic
Title: Re: Separating the sticky topics from the normal ones
Post by: [Unknown] on December 31, 2004, 09:40:18 AM
Don't replace, add after.

-[Unknown]
Title: Re: Separating the sticky topics from the normal ones
Post by: TarantinoArchives on December 31, 2004, 10:33:56 AM
Quote from: [Unknown] on December 31, 2004, 09:40:18 AM
Don't replace, add after.

-[Unknown]

i'll be damned, hehe.
Title: Re: Separating the sticky topics grom the normal ones
Post by: Alisha on January 21, 2005, 02:36:22 AM
Quote from: [Unknown] on September 05, 2004, 07:18:19 PM
I would make it:

if (isset($previousTopicClass) && strpos($previousTopicClass, 'sticky') !== false && !$topic['is_sticky'])
echo '
<tr>
<td>&nbsp;</td>
<td colspan="5">' . $txt[70] . '</td>
</tr>';
$previousTopicClass = $topic['class'];


-[Unknown]

Is there anyway you can make this where the SPACE is filled with the Normal headers, and not just the text70 "SUBJECT" ?  Just want to Mirror the 7 header columns that appear above the sticky posts!
Title: Re: Separating the sticky topics from the normal ones
Post by: [Unknown] on January 21, 2005, 03:13:03 AM
Sure, just copy said headers from the code above that.

-[Unknown]
Title: Re: Separating the sticky topics from the normal ones
Post by: Alisha on January 21, 2005, 03:26:38 AM
Quote from: [Unknown] on January 21, 2005, 03:13:03 AM
Sure, just copy said headers from the code above that.

-[Unknown]

lol now thats funny... No idea what they look like.  they are all $txt[XX]  and I am thinking they would replace this line?

Sorry, getting better but not that good yet...
Title: Re: Separating the sticky topics grom the normal ones
Post by: [Unknown] on January 21, 2005, 03:34:02 AM
You can use this:


if (isset($previousTopicClass) && strpos($previousTopicClass, 'sticky') !== false && !$topic['is_sticky'])
echo '
<tr>
<td width="9%" colspan="2"></td>
<td>', $txt[70], '</td>
<td width="14%">', $txt[109], '</td>
<td width="4%" align="center">', $txt[110], '</td>
<td width="4%" align="center">', $txt[301], '</a></td>
<td width="22%">', $txt[111], '</a></td>
</tr>';
$previousTopicClass = $topic['class'];


-[Unknown]
Title: Re: Separating the sticky topics from the normal ones
Post by: Alisha on January 21, 2005, 03:48:17 AM
Wooohooo Awsome thanks! :)
Title: Re: Separating the sticky topics from the normal ones
Post by: fabio on February 03, 2005, 06:19:54 AM
is there a way to include global announcements in this too ?
Title: Re: Separating the sticky topics from the normal ones
Post by: Owdy on February 03, 2005, 06:30:27 AM
http://mods.simplemachines.org/index.php?mod=78
Title: Re: Separating the sticky topics from the normal ones
Post by: bobert on February 07, 2005, 04:43:29 PM
Is there a way to get rid of those stupid gray bars that say subject. I tried every piece of code here, and none of them seemed to work. Here is by board= http://krawproductions.com/smf/index.php?board=2.0;sort=last_post;desc
Title: Re: Separating the sticky topics grom the normal ones
Post by: eclipselv on February 11, 2005, 09:28:31 PM
Quote from: [Unknown] on January 21, 2005, 03:34:02 AM
You can use this:


if (isset($previousTopicClass) && strpos($previousTopicClass, 'sticky') !== false && !$topic['is_sticky'])
echo '
<tr>
<td width="9%" colspan="2"></td>
<td>', $txt[70], '</td>
<td width="14%">', $txt[109], '</td>
<td width="4%" align="center">', $txt[110], '</td>
<td width="4%" align="center">', $txt[301], '</a></td>
<td width="22%">', $txt[111], '</a></td>
</tr>';
$previousTopicClass = $topic['class'];


-[Unknown]

I added this after:
foreach ($context['topics'] as $topic)
   {

and nothing happened.... i have board 1.0.1

thanks for any help
elv
Title: Re: Separating the sticky topics from the normal ones
Post by: [Unknown] on February 13, 2005, 01:38:23 AM
Quote from: bobert on February 07, 2005, 04:43:29 PM
Is there a way to get rid of those stupid gray bars that say subject. I tried every piece of code here, and none of them seemed to work. Here is by board= http://krawproductions.com/smf/index.php?board=2.0;sort=last_post;desc

Looks like you didn't apply it as described.

Quote from: eclipselv on February 11, 2005, 09:28:31 PM

I added this after:
foreach ($context['topics'] as $topic)
{

and nothing happened.... i have board 1.0.1

Are you sure you did it for the correct template file?  For example, you might be using the "classic" or "converted" theme.

-[Unknown]
Title: Re: Separating the sticky topics from the normal ones
Post by: eclipselv on February 13, 2005, 02:56:24 AM
yes, i did it for the correct template.
i dont understand... i dont see anything different. It does not give any kind of error either..
is there a setting or something i need to turn on?
Im a newb at this board.

here is my board:
http://www.texasdwarfcar.com/forum/

please help
eclipselv
Title: Re: Separating the sticky topics from the normal ones
Post by: DeadMetal on February 13, 2005, 09:15:28 AM
I'd like to do something simpeler, but I need a little help.
I only want to add the text 'Sticky:' in front of the title of a sticky topic.
It should be easy, but I don't succeed.
Title: Re: Separating the sticky topics from the normal ones
Post by: Kindred on February 13, 2005, 10:11:29 AM
There's another thread floating around that describes exactly how to do this...

(do a search?)

but specifically, in MesageIndex.template.php, you need to have this code where it checks for the first post...

                        <span style="', $topic['is_sticky'] ? 'font-weight: bold;' : '', $topic['is_locked'] ? 'font-style: italic;' : '', '" title="', $topic['first_post']['preview'], '">
                                ', $topic['is_sticky'] ? 'Sticky: ' : ($topic['is_locked'] ? 'Locked: ' : ''), ' ', $topic['first_post']['link'], '
                        </span>';
Title: Re: Separating the sticky topics from the normal ones
Post by: eclipselv on February 13, 2005, 10:16:51 PM
I finally got this separator to work.
I had to reinstall the forum and now it works fine.
Don't ask me what the prob was, cause I don't know.
------------------------
Quote from: kindred on February 13, 2005, 10:11:29 AM
There's another thread floating around that describes exactly how to do this...

(do a search?)

but specifically, in MesageIndex.template.php, you need to have this code where it checks for the first post...

<span style="', $topic['is_sticky'] ? 'font-weight: bold;' : '', $topic['is_locked'] ? 'font-style: italic;' : '', '" title="', $topic['first_post']['preview'], '">
', $topic['is_sticky'] ? 'Sticky: ' : ($topic['is_locked'] ? 'Locked: ' : ''), ' ', $topic['first_post']['link'], '
</span>';


I'm a newb at this forum, and when it comes to editing code.
Can someone help me out on the code I need to find to place labels in front of stickies.
I did a search and found nothing.
I would like someone to tell me exactly where to place this code... Does anyone know?
I want to thank all of you for your help, it makes transitioning to a new forum much easier.

Eclipselv
Title: Re: Separating the sticky topics from the normal ones
Post by: Midgard on February 23, 2005, 12:36:41 PM
I love you Ben :) :P

Meanwhile, which one true? (from codes?)
Title: Re: Separating the sticky topics from the normal ones
Post by: Xarcell on June 10, 2005, 02:01:01 PM
He's right, fer some reason it seperates the stickies, but has the first post mixed in with it. Where do I place that <span> code?

-Xarcell
Title: Re: Separating the sticky topics from the normal ones
Post by: anshar on June 23, 2005, 01:45:02 PM
Great topic, I've got a question....

How to make this separate bar thiner, with different font colour on it ? (atm fonts are black, and I need white)
Title: Re: Separating the sticky topics from the normal ones
Post by: dtm.exe on June 29, 2005, 10:29:32 PM
This works great on my forums :).

-Dan The Man
Title: Re: Separating the sticky topics from the normal ones
Post by: Poppet on July 02, 2005, 07:02:38 PM
Quote from: anshar on June 23, 2005, 01:45:02 PM
Great topic, I've got a question....

How to make this separate bar thiner, with different font colour on it ? (atm fonts are black, and I need white)

I'd like the font to be white too  :)
Title: Re: Separating the sticky topics from the normal ones
Post by: ernomo98 on July 05, 2005, 08:09:33 AM
I only find foreach ($context['boards'] as $board) in my MessageIndex.template.php
is this the same?
can I replace this with the follow code?
Quote$stickybar = false;
$normalbar = false;
foreach($context['topics'] as $topic)
{
if($topic['is_sticky'] && !$stickybar)
{
echo'<tr class="titlebg"><td colspan="', empty($options['display_quick_mod']) ? '7' : '8', '"><b>Important Topics</b></td></tr>';
$stickybar = true;
}
else if(!$topic['is_sticky'] && $stickybar && !$normalbar)
{
echo'<tr class="titlebg"><td colspan="', empty($options['display_quick_mod']) ? '7' : '8', '"><b>Normal Topics</b></td></tr>';
$normalbar = true;
}
Title: Re: Separating the sticky topics from the normal ones
Post by: ernomo98 on July 05, 2005, 10:00:45 AM
I find it.
Thank you.
Title: Re: Separating the sticky topics from the normal ones
Post by: Sol on July 23, 2005, 12:26:03 PM
How would I go about editing this in SMF 1.1 Beta 3?

I know you moved some stuff to sub files but I couldn't find any of this code so I guess you've redone this piece of code or something. Have I missed something or is this mod useless now?

Sol edit: Sorry. SMF 1.1 (Beta 3) has a space between the foreach and the reat of the code. Fixed it now.
Title: Re: Separating the sticky topics from the normal ones
Post by: Jochus on August 04, 2005, 06:18:59 AM
Thnx! This option is great!
Title: Re: Separating the sticky topics from the normal ones
Post by: pierse on August 04, 2005, 04:15:55 PM
Quote from: TarantinoArchives on December 31, 2004, 07:58:38 AM
Quote
// No topics.... just say, "sorry bub".
   else
      echo '
               <td width="100%" colspan="7"><b>', $txt[151], '</b></td>';

   echo '
            </tr>';

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

i replace the bold text with what was suggested in this topic

This worked like a charm! Thanks guys!
Title: Re: Separating the sticky topics from the normal ones
Post by: Xarcell on August 21, 2005, 03:37:26 PM
The script works well, but what if I want a another line above the sticky posts just like the one below.

How can I do that?

Thanx,

-Xarcell, php noob.
Title: Re: Separating the sticky topics from the normal ones
Post by: edi67 on October 02, 2005, 03:14:46 AM
not work with SMF 1.1 somebody have some solution for I would like to know how to separate the sticky topics from the rest of the normal topics.

???
Title: Re: Separating the sticky topics from the normal ones
Post by: TLM on October 02, 2005, 11:58:15 PM
Quote from: edi67 on October 02, 2005, 03:14:46 AM
not work with SMF 1.1 somebody have some solution for I would like to know how to separate the sticky topics from the rest of the normal topics.

???
It does work, got it working on my forums.

MessageIndex.template.php starting at about line 150

// No topics.... just say, "sorry bub".
else
echo '
<td width="100%" colspan="7"><b>', $txt[151], '</b></td>';

echo '
</tr>';

        //For the stick/nonstick listings...
        $stickybar = false;
    $normalbar = false;

foreach ($context['topics'] as $topic)
{
            if($topic['is_sticky'] && !$stickybar)
            {
                echo'
                <tr class="windowbg2">
                    <td colspan="', empty($options['display_quick_mod']) ? '7' : '8', '"><b>Important Topics</b></td></tr>';
    $stickybar = true;
            }
            else if(!$topic['is_sticky'] && $stickybar && !$normalbar)
            {
                echo'
                <tr class="windowbg2">
                    <td colspan="', empty($options['display_quick_mod']) ? '7' : '8', '"><b>Normal Topics</b></td></tr>';
                $normalbar = true;
            }

echo '
<tr class="windowbg2">
<td valign="middle" align="center" width="5%">
Title: Re: Separating the sticky topics from the normal ones
Post by: spaceman on October 08, 2005, 02:54:07 AM
Quote from: TLM on October 02, 2005, 11:58:15 PM
Quote from: edi67 on October 02, 2005, 03:14:46 AM
not work with SMF 1.1 somebody have some solution for I would like to know how to separate the sticky topics from the rest of the normal topics.

???
It does work, got it working on my forums.

MessageIndex.template.php starting at about line 150

// No topics.... just say, "sorry bub".
else
echo '
<td width="100%" colspan="7"><b>', $txt[151], '</b></td>';

echo '
</tr>';

        //For the stick/nonstick listings...
        $stickybar = false;
    $normalbar = false;

foreach ($context['topics'] as $topic)
{
            if($topic['is_sticky'] && !$stickybar)
            {
                echo'
                <tr class="windowbg2">
                    <td colspan="', empty($options['display_quick_mod']) ? '7' : '8', '"><b>Important Topics</b></td></tr>';
    $stickybar = true;
            }
            else if(!$topic['is_sticky'] && $stickybar && !$normalbar)
            {
                echo'
                <tr class="windowbg2">
                    <td colspan="', empty($options['display_quick_mod']) ? '7' : '8', '"><b>Normal Topics</b></td></tr>';
                $normalbar = true;
            }

echo '
<tr class="windowbg2">
<td valign="middle" align="center" width="5%">


Got it working on my forum and it looks nice! Thank you very much! :D

http://freshmidis.uni.cc/v2/forums/index.php?board=1.0
Title: Re: Separating the sticky topics from the normal ones
Post by: Elmacik on October 08, 2005, 02:57:09 AM
i think this should be default in 1.1
Title: Re: Separating the sticky topics from the normal ones
Post by: shark on October 15, 2005, 02:20:21 AM
Hi guys. Im using SMF 1.1 RC1, not using the default theme.
And i cant find MessageIndex.template.php in my current theme.
What should i do to separate the sticky topics from the normal ones?
Title: Re: Separating the sticky topics from the normal ones
Post by: TLM on October 15, 2005, 12:51:22 PM
Copy the MessageIndex from the default them, edit, and place in your themes directory...
Title: Re: Separating the sticky topics from the normal ones
Post by: dcmouser on October 16, 2005, 09:16:42 PM
thanks for this thread, works great.
Title: Re: Separating the sticky topics from the normal ones
Post by: houston on October 19, 2005, 09:24:59 PM
Has anybody implememted this into smf 1.1 rc1? I am having trouble understanding what to put in and where.

Thanks
Title: Re: Separating the sticky topics from the normal ones
Post by: trenchteam on October 20, 2005, 03:18:29 AM
yep! works great.

I just followed the directions.

http://www.shoyoroll.com/forum
Title: Re: Separating the sticky topics from the normal ones
Post by: gerrymore on November 09, 2005, 12:16:31 PM
Quote from: houston on October 19, 2005, 09:24:59 PM
Has anybody implememted this into smf 1.1 rc1? I am having trouble understanding what to put in and where.

Thanks

I'm the same. There doesnt seem to be any proper details on how to do this. ie; what to find, what to add/replace. So many people posting different solutions, way too confusing for us php beginers.

This should be in as a standard feature. Turn it on or off in the admin area.
Title: Re: Separating the sticky topics from the normal ones
Post by: Sverre on November 09, 2005, 01:03:05 PM
Quote from: gerrymore on November 09, 2005, 12:16:31 PM
Quote from: houston on October 19, 2005, 09:24:59 PM
Has anybody implememted this into smf 1.1 rc1? I am having trouble understanding what to put in and where.

Thanks

I'm the same. There doesnt seem to be any proper details on how to do this. ie; what to find, what to add/replace. So many people posting different solutions, way too confusing for us php beginers.

This should be in as a standard feature. Turn it on or off in the admin area.

The code posted by [Unknown] on page two of this thread (http://www.simplemachines.org/community/index.php?topic=17230.15) works very well in 1.1 RC1 (if you want a slightly thinner bar, scroll down to post three).

Just add it in MessageIndex.template.php after:

foreach ($context['topics'] as $topic)
{
Title: Re: Separating the sticky topics from the normal ones
Post by: gerrymore on November 09, 2005, 02:09:41 PM
OK, Thanks. I managed to get the code you mentioned working. But the titles Impotant and Normal topics weren't there. I tried one of the others which does give the titles. However, we now have thick dark grey lines between all topics (it looks like exrta rows in the table filled with dark grey). How do I get rid of the thick grey parts and make it look as it did before any changes? Have a screenshot but cant post it here.
Title: Re: Separating the sticky topics from the normal ones
Post by: Sverre on November 09, 2005, 02:34:05 PM
If you haven't done any other modifications to MessageIndex.template.php, upload a fresh copy of it and find:


// No topics.... just say, "sorry bub".
else
echo '
<td width="100%" colspan="7"><b>', $txt[151], '</b></td>';

echo '
</tr>';

foreach ($context['topics'] as $topic)
{
echo '
<tr class="windowbg2">
<td valign="middle" align="center" width="5%">



Replace with TLM's code:

// No topics.... just say, "sorry bub".
else
echo '
<td width="100%" colspan="7"><b>', $txt[151], '</b></td>';

echo '
</tr>';

        //For the stick/nonstick listings...
        $stickybar = false;
    $normalbar = false;

foreach ($context['topics'] as $topic)
{
            if($topic['is_sticky'] && !$stickybar)
            {
                echo'
                <tr class="windowbg2">
                    <td colspan="', empty($options['display_quick_mod']) ? '7' : '8', '"><b>Important Topics</b></td></tr>';
    $stickybar = true;
            }
            else if(!$topic['is_sticky'] && $stickybar && !$normalbar)
            {
                echo'
                <tr class="windowbg2">
                    <td colspan="', empty($options['display_quick_mod']) ? '7' : '8', '"><b>Normal Topics</b></td></tr>';
                $normalbar = true;
            }

echo '
<tr class="windowbg2">
<td valign="middle" align="center" width="5%">
Title: Re: Separating the sticky topics from the normal ones
Post by: gerrymore on November 09, 2005, 03:00:35 PM
Thanks Sverre, you're a star. I dont know what went wrong as my code and yours looked the same. Must have missed something.
Title: Re: Separating the sticky topics from the normal ones
Post by: dairin on December 04, 2005, 12:01:09 PM
Quote from: Xarcell on August 21, 2005, 03:37:26 PM
The script works well, but what if I want a another line above the sticky posts just like the one below.

How can I do that?

Thanx,

-Xarcell, php noob.

any1 know how to solve this part ??
my version is SMF 1.0.5
Title: Re: Separating the sticky topics from the normal ones
Post by: kuklovod on December 07, 2005, 03:56:54 AM
related to this thread, released a new mod for 1.0.5/1.1RC1, reversible, adds separator after sticky topics and also sticks first post in sticky topics (makes it appear on every page if the stickied topic is multipage, with a separator from the rest of the posts):

http://mods.simplemachines.org/index.php?mod=235
Title: Re: Separating the sticky topics from the normal ones
Post by: CuTe_MaN on December 08, 2005, 05:34:51 AM
thx for the nice modification

I have applied it and every thing is working very well, I was wondering if it possible to make sticky topics on all pages in the same board and they still be seperated from regullar topics.

thx
Title: Re: Separating the sticky topics from the normal ones
Post by: Simplemachines Cowboy on January 29, 2006, 01:57:25 PM
Has anyone worked out a way to separate the stickies in RC2?

Other than kuklovod's sticky mod.
I like the new look of RC2 with the identified stickies but I wish the separation and Important topics/normal topics differentiation that the code provided.
Title: Re: Separating the sticky topics from the normal ones
Post by: Sol on February 01, 2006, 02:47:27 PM
SM Cowboy, just edit the files like before. Some of the search criteria may have changed slightly but it's still a very usable method.

I have used on the RC2 Default theme a while ago.
Title: Re: Separating the sticky topics from the normal ones
Post by: trenchteam on February 19, 2006, 02:11:00 AM
Quote from: Sverre on November 09, 2005, 02:34:05 PM
If you haven't done any other modifications to MessageIndex.template.php, upload a fresh copy of it and find:


// No topics.... just say, "sorry bub".
else
echo '
<td width="100%" colspan="7"><b>', $txt[151], '</b></td>';

echo '
</tr>';

foreach ($context['topics'] as $topic)
{
echo '
<tr class="windowbg2">
<td valign="middle" align="center" width="5%">



Replace with TLM's code:

// No topics.... just say, "sorry bub".
else
echo '
<td width="100%" colspan="7"><b>', $txt[151], '</b></td>';

echo '
</tr>';

        //For the stick/nonstick listings...
        $stickybar = false;
    $normalbar = false;

foreach ($context['topics'] as $topic)
{
            if($topic['is_sticky'] && !$stickybar)
            {
                echo'
                <tr class="windowbg2">
                    <td colspan="', empty($options['display_quick_mod']) ? '7' : '8', '"><b>Important Topics</b></td></tr>';
    $stickybar = true;
            }
            else if(!$topic['is_sticky'] && $stickybar && !$normalbar)
            {
                echo'
                <tr class="windowbg2">
                    <td colspan="', empty($options['display_quick_mod']) ? '7' : '8', '"><b>Normal Topics</b></td></tr>';
                $normalbar = true;
            }

echo '
<tr class="windowbg2">
<td valign="middle" align="center" width="5%">


Exactly what I was looking for! Thanks! ;D
Title: Re: Separating the sticky topics from the normal ones
Post by: cldnails on February 19, 2006, 10:30:34 AM
What trenchteam said, works exactly the way I wanted.  Just required a little tweak for important thread to my personal favorite, sticky's. :) Thanks.
Title: Re: Separating the sticky topics from the normal ones
Post by: nasty_b on March 14, 2006, 06:45:34 PM
Is there a way to simply add the text "Sticky:" in front of the subject instead of having each sticky seperated? Thanks.
Title: Re: Separating the sticky topics from the normal ones
Post by: tedgraves on April 10, 2006, 12:13:11 PM
MessageIndex.template.php

I dont have that file! ant help please!!
Title: Re: Separating the sticky topics from the normal ones
Post by: Kindred on April 10, 2006, 12:41:34 PM
everyone has that file...   it might not be used specifically for your theme, in which case the fil;e in the default theme directory is used.
Title: Re: Separating the sticky topics from the normal ones
Post by: eriktm on April 10, 2006, 12:58:41 PM
Quote from: tedgraves on April 10, 2006, 12:13:11 PM
I dont have that file! ant help please!!

Look in /Themes/default/
Title: Re: Separating the sticky topics from the normal ones
Post by: geezmo on April 24, 2006, 10:44:01 PM
Help guys, I want to integrate this in my forum but my MessageIndex.template.php looks like this and I don't know how to insert the code. The ones in red are the ones I need to replace, but there are codes in betweena dn I don't know how to insert the new code.

Quote
      // No topics.... just say, "sorry bub".
      else
         echo '
                  <td class="catbg3" width="100%" colspan="7"><b>', $txt[151], '</b></td>';

      echo '
               </tr>';

      if (!empty($settings['display_who_viewing']))
      {
         echo '
               <tr class="windowbg2">
                  <td colspan="' , !empty($options['display_quick_mod']) ? '8' : '7' , '"><small>';
         if ($settings['display_who_viewing'] == 1)
            echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt[19];
         else
            echo empty($context['view_members_list']) ? '0 ' . $txt[19] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) or $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')');
         echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_board'], '
                  </small></td>
               </tr>';
      }

      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'], 0, strrpos($topic['class'], '_sticky'));
         if (!empty($settings['seperate_sticky_lock']) && strpos($topic['class'], 'locked') !== false)
            $topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_locked'));

         echo '
               <tr>
                  <td class="windowbg2" valign="middle" align="center" width="5%">
Title: Re: Separating the sticky topics from the normal ones
Post by: Vinspire^ on April 27, 2006, 03:32:38 AM
Yeap. I am also having the same situation as geezmo. Anyone here got the answer ?
Title: Re: Separating the sticky topics from the normal ones
Post by: Vinspire^ on April 28, 2006, 03:05:01 AM
Someone please give the answer asap :(
Title: Re: Separating the sticky topics from the normal ones
Post by: Vinspire^ on April 30, 2006, 10:39:37 PM
Happy labour day ... had been waiting for an answer for about a week  :'(
Title: Re: Separating the sticky topics from the normal ones
Post by: TechnoDragon on May 02, 2006, 12:28:11 AM
do what this post says and it works...it is exactly what i did...

http://www.simplemachines.org/community/index.php?topic=17230.msg135326#msg135326
Title: Re: Separating the sticky topics from the normal ones
Post by: Vinspire^ on May 02, 2006, 06:45:54 AM
Quote from: TechnoDragon on May 02, 2006, 12:28:11 AM
do what this post says and it works...it is exactly what i did...

http://www.simplemachines.org/community/index.php?topic=17230.msg135326#msg135326

Yay ... thanks a lot TechnoDragon. I found it and its working well :)
Title: Re: Separating the sticky topics from the normal ones
Post by: TechnoDragon on May 02, 2006, 09:17:09 AM
Glad to be of help!
Title: Re: Separating the sticky topics from the normal ones
Post by: Vinspire^ on May 02, 2006, 11:49:29 AM
I've change the "important topics" to "pinned topic" :P

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg312.imageshack.us%2Fimg312%2F7429%2Ftopic6lf.jpg&hash=13e48af86a294a078dd633082dd32f9725b6c335) (http://imageshack.us)
Title: Re: Separating the sticky topics from the normal ones
Post by: TechnoDragon on May 02, 2006, 12:03:45 PM
Good going!
Title: Re: Separating the sticky topics from the normal ones
Post by: L.G.S on May 12, 2006, 12:55:06 PM
Hi,

as you can see here I have used TML's code from page 4 or 5, and I have this:

http://www.tactical-illusion.com/board/index.php?board=7.0

How do I get the box at the end the same colour as the rest?
Title: Re: Separating the sticky topics from the normal ones
Post by: Sverre on May 12, 2006, 03:33:32 PM
Quote from: L.G.S on May 12, 2006, 12:55:06 PM
How do I get the box at the end the same colour as the rest?

This happens because you have an extra column in your Message Index. I haven't tested it myself, but if you change TML's code to


// No topics.... just say, "sorry bub".
else
echo '
<td width="100%" colspan="8"><b>', $txt[151], '</b></td>';

echo '
</tr>';

        //For the stick/nonstick listings...
        $stickybar = false;
    $normalbar = false;

foreach ($context['topics'] as $topic)
{
            if($topic['is_sticky'] && !$stickybar)
            {
                echo'
                <tr class="windowbg2">
                    <td colspan="', empty($options['display_quick_mod']) ? '8' : '9', '"><b>Important Topics</b></td></tr>';
    $stickybar = true;
            }
            else if(!$topic['is_sticky'] && $stickybar && !$normalbar)
            {
                echo'
                <tr class="windowbg2">
                    <td colspan="', empty($options['display_quick_mod']) ? '8' : '9', '"><b>Normal Topics</b></td></tr>';
                $normalbar = true;
            }

echo '
<tr class="windowbg2">
<td valign="middle" align="center" width="5%">


it should work.
Title: Re: Separating the sticky topics from the normal ones
Post by: L.G.S on May 12, 2006, 03:53:01 PM
Changed it but it's made it worse :(

http://www.tactical-illusion.com/board/index.php?board=7.0
Title: Re: Separating the sticky topics from the normal ones
Post by: Sverre on May 12, 2006, 04:30:07 PM
Can you compare the code I posted above with the one you had running before (and now) to make sure that the only changes are colspan 7 to 8 and 8 to 9?

I don't know much about coding, but don't see why that shouldn't work :-\
Title: Re: Separating the sticky topics from the normal ones
Post by: L.G.S on May 12, 2006, 04:45:57 PM
All I did was find the code from TML and replace it with your one :(
Title: Re: Separating the sticky topics from the normal ones
Post by: Burtie on May 19, 2006, 09:54:13 AM
Hi,

Could anyone tell me how to change just the background colour of a sticky topic?

:)
Title: Re: Separating the sticky topics from the normal ones
Post by: karras.us on May 26, 2006, 12:18:48 AM
Thanks TarantinoArchives & [Unknown], works like a charm.

I had to remove one of the <td colspan="2">, but everythings looks perfect.

Thanks again.  :D
Title: Re: Separating the sticky topics from the normal ones
Post by: Jmecca2 on June 18, 2007, 01:37:17 AM
thanks, just what i was looking for ;D
Title: Re: Separating the sticky topics from the normal ones
Post by: amirali.b on June 24, 2007, 03:44:33 PM
Quote from: Ben_S on September 05, 2004, 06:37:36 PM
Tips and tricks I beleive.

Well it did, but now the topic is in the bin ???

MessageIndex.template.php

Find
foreach($context['topics'] as $topic)
{


Replace With

$stickybar = false;
$normalbar = false;
foreach($context['topics'] as $topic)
{
if($topic['is_sticky'] && !$stickybar)
{
echo'<tr class="titlebg"><td colspan="', empty($options['display_quick_mod']) ? '7' : '8', '"><b>Important Topics</b></td></tr>';
$stickybar = true;
}
else if(!$topic['is_sticky'] && $stickybar && !$normalbar)
{
echo'<tr class="titlebg"><td colspan="', empty($options['display_quick_mod']) ? '7' : '8', '"><b>Normal Topics</b></td></tr>';
$normalbar = true;
}


I take no credit for that, just a copy and paste.
thanks ...it works well :)
but how can I bold the Sticky topics and change the background color of them? sorry alot of topics about that but I cant find the correct answer!!

regards.
Title: Re: Separating the sticky topics from the normal ones
Post by: kill3r on June 29, 2007, 01:23:55 PM
hey thanks, this tip works great.
Title: Re: Separating the sticky topics from the normal ones
Post by: eugene_lazarev on September 21, 2007, 01:56:22 PM
hey!

i use this (http://www.simplemachines.org/community/index.php?topic=17230.msg135326#msg135326) tip, but i need to mark all "normal" topics ALWAYS, not only when "important" topics are.

what's needing to change?


p.s. sorry for my English)
Title: Re: Separating the sticky topics from the normal ones
Post by: Neorics on September 22, 2007, 10:06:23 AM
hey great tip, thanks for sharing!!!
Title: Re: Separating the sticky topics from the normal ones
Post by: jesuscamp1 on October 07, 2007, 06:57:07 AM
Quote from: Ben_S on September 05, 2004, 06:37:36 PM
Tips and tricks I beleive.

Well it did, but now the topic is in the bin ???

MessageIndex.template.php

Find
foreach($context['topics'] as $topic)
{


Replace With

$stickybar = false;
$normalbar = false;
foreach($context['topics'] as $topic)
{
if($topic['is_sticky'] && !$stickybar)
{
echo'<tr class="titlebg"><td colspan="', empty($options['display_quick_mod']) ? '7' : '8', '"><b>Important Topics</b></td></tr>';
$stickybar = true;
}
else if(!$topic['is_sticky'] && $stickybar && !$normalbar)
{
echo'<tr class="titlebg"><td colspan="', empty($options['display_quick_mod']) ? '7' : '8', '"><b>Normal Topics</b></td></tr>';
$normalbar = true;
}


I take no credit for that, just a copy and paste.

Thank you!!!!  ;D

in spanish

Muchas gracias
Title: Re: Separating the sticky topics from the normal ones
Post by: hayley2007 on October 29, 2007, 04:56:56 AM
why doesnt Ben_s one work for me? im on 1.1.4 when i do the code change, nothing changes at all :/
Title: Re: Separating the sticky topics from the normal ones
Post by: ham1299 on November 02, 2007, 10:48:18 PM
This is awesome. Worked very nicely! Thanks! :D
Title: Re: Separating the sticky topics from the normal ones
Post by: Sarge on December 09, 2007, 03:08:14 AM
Quote from: hayley2007 on October 29, 2007, 04:56:56 AM
why doesnt Ben_s one work for me? im on 1.1.4 when i do the code change, nothing changes at all :/

Are you sure the modified file overwrote the original when you uploaded it?

Download it again and see if it contains the changes you made.
Title: Re: Separating the sticky topics from the normal ones
Post by: seymoor on December 18, 2007, 04:12:41 PM
same thing happening to me, as nothing happening after the modification.

sources/messageindex.php
// Set permissions for all the topics.
foreach ($context['topics'] as $t => $topic)
{
if (isset($previousTopicClass) && strpos($previousTopicClass, 'sticky') !== false && !$topic['is_sticky'])
      echo '
         <tr class="titlebg">
         <td colspan="2">&nbsp;</td>
         <td colspan="7">&nbsp;</td>
         </tr>';
$previousTopicClass = $topic['class'];

$started = $topic['first_post']['member']['id'] == $ID_MEMBER;
$context['topics'][$t]['quick_mod'] = array(
'lock' => allowedTo('lock_any') || ($started && allowedTo('lock_own')),
'sticky' => allowedTo('make_sticky') && !empty($modSettings['enableStickyTopics']),
'move' => allowedTo('move_any') || ($started && allowedTo('move_own')),
'modify' => allowedTo('modify_any') || ($started && allowedTo('modify_own')),
'remove' => allowedTo('remove_any') || ($started && allowedTo('remove_own'))
);
$context['can_lock'] |= ($started && allowedTo('lock_own'));
$context['can_move'] |= ($started && allowedTo('move_own'));
$context['can_remove'] |= ($started && allowedTo('remove_own'));
}



is it in the wrong place or...?
Title: Re: Separating the sticky topics from the normal ones
Post by: Mick. on December 23, 2007, 04:26:30 PM
I think i found a problem here.

In the 2nd posts,states to find:

foreach($context['topics'] as $topic)
{


But i found this instead:

foreach ($context['topics'] as $t => $topic)
{


which there not the same?

Any way to rewrite the tip?

Title: Re: Separating the sticky topics from the normal ones
Post by: Oldiesmann on January 19, 2008, 10:13:35 PM
Quote from: seymoor on December 18, 2007, 04:12:41 PM
same thing happening to me, as nothing happening after the modification.

sources/messageindex.php
// Set permissions for all the topics.
  foreach ($context['topics'] as $t => $topic)
  {
if (isset($previousTopicClass) && strpos($previousTopicClass, 'sticky') !== false && !$topic['is_sticky'])
      echo '
         <tr class="titlebg">
         <td colspan="2">&nbsp;</td>
         <td colspan="7">&nbsp;</td>
         </tr>';
$previousTopicClass = $topic['class'];
 
   $started = $topic['first_post']['member']['id'] == $ID_MEMBER;
   $context['topics'][$t]['quick_mod'] = array(
    'lock' => allowedTo('lock_any') || ($started && allowedTo('lock_own')),
    'sticky' => allowedTo('make_sticky') && !empty($modSettings['enableStickyTopics']),
    'move' => allowedTo('move_any') || ($started && allowedTo('move_own')),
    'modify' => allowedTo('modify_any') || ($started && allowedTo('modify_own')),
    'remove' => allowedTo('remove_any') || ($started && allowedTo('remove_own'))
   );
   $context['can_lock'] |= ($started && allowedTo('lock_own'));
   $context['can_move'] |= ($started && allowedTo('move_own'));
   $context['can_remove'] |= ($started && allowedTo('remove_own'));
  }



is it in the wrong place or...?
You're modifying the wrong file. You want to modify Themes/default/Messageindex.template.php, not Sources/Messageindex.php.

Quote from: BlueDevil on December 23, 2007, 04:26:30 PM
I think i found a problem here.

In the 2nd posts,states to find:

foreach($context['topics'] as $topic)
{


But i found this instead:

foreach ($context['topics'] as $t => $topic)
  {


which there not the same?

Any way to rewrite the tip?


It shouldn't matter. The only difference is that the code you found is separating the array keys into a separate variable. You're only interested in the array values.
Title: Re: Separating the sticky topics from the normal ones
Post by: Mick. on January 20, 2008, 12:19:04 PM
Thanx Oldiesmann.  Reply #2 worked.
Title: Re: Separating the sticky topics from the normal ones
Post by: Antechinus on November 30, 2008, 02:20:52 PM
I want to have a go at updating this for SMF 2 but the code I'm supposed to find doesn't exist. Has anyone already sorted this for SMF 2?

ETA: Ok, found the code line. In 2b4 there is a space in it which threw my first search result off. No problem. This code works as advertised in 2b4 with no alteration. Just remember to change this line at the beginning of the file from this:

global $context, $settings, $options, $scripturl, $modSettings, $txt;

to this:

global $context, $settings, $options, $scripturl, $modSettings, $txt, $stickybar, $normalbar;

If you don't do this you may get undefined index errors.
Title: Re: Separating the sticky topics from the normal ones
Post by: Stuart on December 26, 2008, 02:43:16 PM
I really like this option but would also love to separate the active topics from the ones which are locked. It would be great if all these locked topics could be sorted and end up underneath the normal topics. Any ideas?
Title: Re: Separating the sticky topics from the normal ones
Post by: Kindred on December 26, 2008, 04:49:38 PM
well, by nature, the locked and unposted-in (but still sticky) topics will end up at the bottom of the sticky list as the more frequently posted to sticky topics get more recent dates.

However, I belive there is a mod that allows you to order your sticky topics.
Title: Re: Separating the sticky topics from the normal ones
Post by: coldfusionpower on January 17, 2009, 07:22:14 AM
im getting this after changing the code according this (http://www.simplemachines.org/community/index.php?topic=17230.msg135326#msg135326) on SMF 2.0.4

Parse error: syntax error, unexpected $end in .../Themes/BlackRainV2_20b4/MessageIndex.template.php on line 513

504:





$buttonArray[] = '<a href="' . $scripturl . '?action=post;board=' . $context['current_board'] . '.0">' . $txt['new_topic'] . '</a>';
505:
506:



// How about new polls, can the user post those?
507:



if ($context['can_post_poll'])
508:





$buttonArray[] = '<a href="' . $scripturl . '?action=post;board=' . $context['current_board'] . '.0;poll">' . $txt['new_poll'] . '</a>';
509:
510:



return implode('  |  ', $buttonArray);
511: }
512:

513: ?>
Title: Re: Separating the sticky topics from the normal ones
Post by: coldfusionpower on January 21, 2009, 12:23:20 PM
someone please help me on this .. thanks ....
Title: Re: Separating the sticky topics from the normal ones
Post by: Antechinus on January 21, 2009, 12:43:14 PM
Attach the whole file. The error is somewhere else, because this hack doesn't touch the end of the file.
Title: Re: Separating the sticky topics from the normal ones
Post by: Lamarck on April 15, 2009, 04:17:45 PM
Hi,can someone modify this code to work with Global Topics Mod in SMF 2.0 RC1??

It would be nice,the modification doesn't work properly with global topics MOD installed.I want global topics shown with stickys (separate from normal topics).

Any help? Thanks and sorry for my bad english.
Title: Re: Separating the sticky topics from the normal ones
Post by: STS on June 20, 2009, 12:13:03 AM
Quote from: [Unknown] on October 01, 2004, 03:10:10 AM

if (isset($previousTopicClass) && strpos($previousTopicClass, 'sticky') !== false && !$topic['is_sticky'])
echo '
<tr class="titlebg" style="font-size: 1ex;">
<td colspan="2">&nbsp;</td>
<td colspan="7">&nbsp;</td>
</tr>';
$previousTopicClass = $topic['class'];


-[Unknown]

This worked FANTASTIC. I removed the &nbsp; and that gave me the exact divider size I wanted. Thanks much.
Title: Re: Separating the sticky topics from the normal ones
Post by: steve51184 on January 31, 2010, 10:28:30 PM
anything like this for 2.0 rc2?
Title: Re: Separating the sticky topics from the normal ones
Post by: Doc.Blade on July 07, 2011, 06:44:30 AM
Hello,

Sorry to dredge up an old post, but i just need a little help :)

I have the latest version of SMF 2.0 running.

I am using the following code for separating the stickies and posts:

Find:

foreach($context['topics'] as $topic)
{


Replace With:

$stickybar = false;
$normalbar = false;
foreach($context['topics'] as $topic)
{
if($topic['is_sticky'] && !$stickybar)
{
echo'<tr class="titlebg"><td colspan="', empty($options['display_quick_mod']) ? '7' : '8', '"><b>Stickies</b></td></tr>';
$stickybar = true;
}
else if(!$topic['is_sticky'] && $stickybar && !$normalbar)
{
echo'<tr class="titlebg"><td colspan="', empty($options['display_quick_mod']) ? '7' : '8', '"><b>Posts</b></td></tr>';
$normalbar = true;
}



This works perfectly on my forums, with one exception.  The bars that separate things on my template are black, and makes the writing invisible.

The writing is definitely on the bar, as i can highlight it with my mouse and see it.

I just need to know what to change so the text can come up in white please?

I appreciate any help anyone can offer.

Thanx

Doc
Title: Re: Separating the sticky topics from the normal ones
Post by: MrGrumpy on July 07, 2011, 08:26:04 PM
A link would help to see exactly what you mean.
Title: Re: Separating the sticky topics from the normal ones
Post by: Doc.Blade on July 07, 2011, 10:12:37 PM
Unfortunately it is a private forum, so links wont show you what i am talking about.

So, i took some screen captures.  First one is looking at the forum, second is highlighting the text so you can see it is actually there, just in a black font and pretty well invisible:

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.docblade.com%2FToombul%2F1.jpg&hash=09720fb526b6f477b65a6b5006a99f47647bce63)

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.docblade.com%2FToombul%2F2.jpg&hash=fe8fa31f25bc843b13adc117be34521386ecb3d1)


I basically need to know what i need to do with the code in my original post to make the text (Stickies and Posts) font to be white.

Thanx in advance for any help anyone can offer.

Doc
Title: Re: Separating the sticky topics from the normal ones
Post by: MrGrumpy on July 08, 2011, 05:13:00 AM
Look at the titlebg class in index.css, on that class you will have color: #000;color:#000000; or color: black; (it can be done in 3 ways)
Change that color to what you want.
Title: Re: Separating the sticky topics from the normal ones
Post by: Doc.Blade on July 08, 2011, 07:47:30 AM
unfortunately titlebg comes up 32 times in my index.css file, dont know which one to change.  They are all colored #000
Title: Re: Separating the sticky topics from the normal ones
Post by: MrGrumpy on July 08, 2011, 09:04:06 AM
can you make a test account so I can access your site and i will able to tell you exactly which to change then you can delete the account after.
Title: Re: Separating the sticky topics from the normal ones
Post by: Kindred on July 08, 2011, 10:11:55 AM
do note that that CSS also controls the display on a dozen other pages....
Title: Re: Separating the sticky topics from the normal ones
Post by: MrGrumpy on July 08, 2011, 10:16:59 AM
Yeah I know and I was bearing in mind the possibility of the need to create a new class just for that section of coding if changes would cause problems throughout the theme but didn't want to overload Doc.Blade with too much information or suggestions in 1 go.
Title: Re: Separating the sticky topics from the normal ones
Post by: Doc.Blade on July 08, 2011, 11:16:52 AM
site is in the initial stages of being built, wanted to see if i can work this out before i go any further, in case i need to change themes or something.

also been far too busy with work to work on the site too much.

just opened what i have setup so far by taking off the .htaccess from the directory.

http://www.docblade.com/Toombul/forum

Cheers for your help.

Doc
Title: Re: Separating the sticky topics from the normal ones
Post by: MrGrumpy on July 08, 2011, 11:39:51 AM
Looking at your site all the titlebg's have the black text on them so I would actually change them all to white as your titlebg image is black so anywhere titlebg is used the text on it will be black, including titlebg2 and the h3/h4.titlebg's

On another note the text for the titles on the bars for the sticky/normal topics is hard coded into the file rather than using text strings, I would do it this way.

$stickybar = false;
$normalbar = false;
foreach($context['topics'] as $topic)
{
if($topic['is_sticky'] && !$stickybar)
{
echo'<tr class="titlebg"><td colspan="', empty($options['display_quick_mod']) ? '7' : '8', '"><strong>',$txt['Stickied_Topics'],'</strong></td></tr>';
$stickybar = true;
}
else if(!$topic['is_sticky'] && $stickybar && !$normalbar)
{
echo'<tr class="titlebg"><td colspan="', empty($options['display_quick_mod']) ? '7' : '8', '"><strong>',$txt['Normal_Topics'],'</strong></td></tr>';
$normalbar = true;
}


You need to make an edit to index.template.php to implement this.

Find

/* Set the following variable to true if this theme requires the optional theme strings file to be loaded. */
$settings['require_theme_strings'] = false;


Change to

/* Set the following variable to true if this theme requires the optional theme strings file to be loaded. */
$settings['require_theme_strings'] = true;


Then make a new file named ThemeStrings.english.php and upload it to the orange themes languages folder (I would attach the file for you but it won't let me attach here)

The contents of the file should be


<?php
// Version: 2.0; Themes

$txt['Stickied_Topics'] = 'Stickied Topics';
$txt['Normal_Topics'] = 'Normal Topics';
?>




You don't have to do this, you can just stick with the way you have it with the title hardcoded into the file but this way is better practice.
Title: Re: Separating the sticky topics from the normal ones
Post by: Doc.Blade on July 11, 2011, 12:48:01 AM
brilliant, thank you MrGrumpy!  I left the coding the way i had it, it works for now...lol

Just one more thing, sorry to be a pain.  How would i change the other titles from white to the orange? 

Like on the Index Page:



When you go into a category:



and when you go into a topic:




Thank you again for your help so far, and thanx in advance for your help with what will HOPEFULLY be my last questions....lol

Doc
Title: Re: Separating the sticky topics from the normal ones
Post by: MrGrumpy on July 11, 2011, 10:59:16 AM
Change the white or #ffffff hex colors to the orange color on the catbg css like how you changed the titlebg css
Title: Re: Separating the sticky topics from the normal ones
Post by: Doc.Blade on July 11, 2011, 09:55:10 PM
Awesome, that got all of them, except for when you go into a category:



Do you know which one that will be?

Thank you so much for your help so far, it has been invaluable!

Doc
Title: Re: Separating the sticky topics from the normal ones
Post by: MrGrumpy on July 12, 2011, 04:55:38 AM
Change the #fff in this code to orange, starts on line 881 in index.css


/* The half-round header bars for some tables. */
.table_grid thead th
{
    height: 28px;
    color: #fff;
    font-family: arial, helvetica, sans-serif;
    font-size: 1.1em;
    font-weight: bold;
    background: url(../images/theme/main_block.png) no-repeat -10px -160px;
}
.table_grid thead th a:link, .table_grid thead th a:visited
{
    color: #fff;
}
Title: Re: Separating the sticky topics from the normal ones
Post by: Doc.Blade on July 12, 2011, 10:52:28 AM
Perfect, thank you so much for your help MrGrumpy, it is greatly appreciated!
Title: Re: Separating the sticky topics from the normal ones
Post by: MrGrumpy on July 14, 2011, 08:09:11 AM
You're welcome Doc.
Title: Re: Separating the sticky topics from the normal ones
Post by: MaNaRa on August 04, 2011, 11:20:45 AM
Hi, I'm trying to add this mod in the latest version of smf (2.0), but can not find this code in the Messageindex.template.php
foreach($context['topics'] as $topic)
{


Any help?
Title: Re: Separating the sticky topics from the normal ones
Post by: MrGrumpy on August 04, 2011, 11:36:44 AM
The spacing isn't right in that bit of code for the 2.0 file

search for

foreach ($context['topics'] as $topic)
Title: Re: Separating the sticky topics from the normal ones
Post by: MaNaRa on August 04, 2011, 12:12:52 PM
ah ok, now works perfect! thanks MrGrumpy