Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Thema gestartet von: Alexandre P. in September 05, 2004, 06:23:54 NACHMITTAGS

Titel: Separating the sticky topics from the normal ones
Beitrag von: Alexandre P. in September 05, 2004, 06:23:54 NACHMITTAGS
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 :)
Titel: Re: Separating the sticky topics grom the normal ones
Beitrag von: [Unknown] in September 05, 2004, 06:37:07 NACHMITTAGS
I remember telling Owdy how to do this one.  Where did that topic go?

-[Unknown]
Titel: Re: Separating the sticky topics grom the normal ones
Beitrag von: Ben_S in September 05, 2004, 06:37:36 NACHMITTAGS
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.
Titel: Re: Separating the sticky topics grom the normal ones
Beitrag von: 127.0.0.1 in September 05, 2004, 07:05:20 NACHMITTAGS
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'];
Titel: Re: Separating the sticky topics grom the normal ones
Beitrag von: [Unknown] in September 05, 2004, 07:18:19 NACHMITTAGS
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]
Titel: Re: Separating the sticky topics grom the normal ones
Beitrag von: Alexandre P. in September 05, 2004, 09:45:02 NACHMITTAGS
This is just excellent :D  Thanks all !
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: TarantinoArchives in September 07, 2004, 02:02:54 NACHMITTAGS
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
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: TarantinoArchives in September 07, 2004, 03:33:12 NACHMITTAGS
ah well, here's what i did now:

Zitat
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
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: evolus in September 08, 2004, 09:09:45 VORMITTAG
Thanx all, that was for me :)
Titel: Seperating Stickys From Normal Topics
Beitrag von: ~Tyris~ in September 27, 2004, 04:36:47 NACHMITTAGS
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! :)
Titel: Re: Seperating Stickys From Normal Topics
Beitrag von: Ben_S in September 27, 2004, 04:39:53 NACHMITTAGS
http://www.simplemachines.org/community/index.php?topic=16265.0
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: A.M.A in September 27, 2004, 05:35:57 NACHMITTAGS
merged topics ..
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Wolfden in September 29, 2004, 10:34:08 NACHMITTAGS
can someone clarify this file name tho?  MessageIndex.template.php   - I'm not finding a template.php
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Wolfden in September 29, 2004, 10:59:43 NACHMITTAGS
ahhh I found it, taking me a bit to get use to the smf file system
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: SilentNoise in Oktober 01, 2004, 03:08:49 VORMITTAG
Zitat von: TarantinoArchives in September 07, 2004, 03:33:12 NACHMITTAGS
ah well, here's what i did now:

Zitat
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?
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: [Unknown] in Oktober 01, 2004, 03:10:10 VORMITTAG

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]
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: SilentNoise in Oktober 01, 2004, 03:25:44 VORMITTAG
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
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: [Unknown] in Oktober 01, 2004, 03:38:41 VORMITTAG
Try removing the &nbsp; parts.

-[Unknown]
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: SilentNoise in Oktober 01, 2004, 03:49:06 VORMITTAG
oh ya.... I'm tired, and should go to bed.

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

Thanx

8)
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: dwayne in Dezember 22, 2004, 01:13:54 VORMITTAG
cant seem to find messageindex.template.php
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: CapriSkye in Dezember 22, 2004, 01:24:55 VORMITTAG
it should be in your template folder
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: TarantinoArchives in Dezember 31, 2004, 07:38:15 VORMITTAG
Zitat
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?
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: [Unknown] in Dezember 31, 2004, 07:49:31 VORMITTAG
Can you post three lines above and below where you're putting that code, please?

-[Unknown]
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: TarantinoArchives in Dezember 31, 2004, 07:58:38 VORMITTAG
Zitat
// 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
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: [Unknown] in Dezember 31, 2004, 09:40:18 VORMITTAG
Don't replace, add after.

-[Unknown]
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: TarantinoArchives in Dezember 31, 2004, 10:33:56 VORMITTAG
Zitat von: [Unknown] in Dezember 31, 2004, 09:40:18 VORMITTAG
Don't replace, add after.

-[Unknown]

i'll be damned, hehe.
Titel: Re: Separating the sticky topics grom the normal ones
Beitrag von: Alisha in Januar 21, 2005, 02:36:22 VORMITTAG
Zitat von: [Unknown] in September 05, 2004, 07:18:19 NACHMITTAGS
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!
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: [Unknown] in Januar 21, 2005, 03:13:03 VORMITTAG
Sure, just copy said headers from the code above that.

-[Unknown]
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Alisha in Januar 21, 2005, 03:26:38 VORMITTAG
Zitat von: [Unknown] in Januar 21, 2005, 03:13:03 VORMITTAG
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...
Titel: Re: Separating the sticky topics grom the normal ones
Beitrag von: [Unknown] in Januar 21, 2005, 03:34:02 VORMITTAG
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]
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Alisha in Januar 21, 2005, 03:48:17 VORMITTAG
Wooohooo Awsome thanks! :)
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: fabio in Februar 03, 2005, 06:19:54 VORMITTAG
is there a way to include global announcements in this too ?
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Owdy in Februar 03, 2005, 06:30:27 VORMITTAG
http://mods.simplemachines.org/index.php?mod=78
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: bobert in Februar 07, 2005, 04:43:29 NACHMITTAGS
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
Titel: Re: Separating the sticky topics grom the normal ones
Beitrag von: eclipselv in Februar 11, 2005, 09:28:31 NACHMITTAGS
Zitat von: [Unknown] in Januar 21, 2005, 03:34:02 VORMITTAG
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
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: [Unknown] in Februar 13, 2005, 01:38:23 VORMITTAG
Zitat von: bobert in Februar 07, 2005, 04:43:29 NACHMITTAGS
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.

Zitat von: eclipselv in Februar 11, 2005, 09:28:31 NACHMITTAGS

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]
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: eclipselv in Februar 13, 2005, 02:56:24 VORMITTAG
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
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: DeadMetal in Februar 13, 2005, 09:15:28 VORMITTAG
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.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Kindred in Februar 13, 2005, 10:11:29 VORMITTAG
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>';
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: eclipselv in Februar 13, 2005, 10:16:51 NACHMITTAGS
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.
------------------------
Zitat von: kindred in Februar 13, 2005, 10:11:29 VORMITTAG
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
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Midgard in Februar 23, 2005, 12:36:41 NACHMITTAGS
I love you Ben :) :P

Meanwhile, which one true? (from codes?)
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Xarcell in Juni 10, 2005, 02:01:01 NACHMITTAGS
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
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: anshar in Juni 23, 2005, 01:45:02 NACHMITTAGS
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)
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: dtm.exe in Juni 29, 2005, 10:29:32 NACHMITTAGS
This works great on my forums :).

-Dan The Man
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Poppet in Juli 02, 2005, 07:02:38 NACHMITTAGS
Zitat von: anshar in Juni 23, 2005, 01:45:02 NACHMITTAGS
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  :)
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: ernomo98 in Juli 05, 2005, 08:09:33 VORMITTAG
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?
Zitat$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;
}
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: ernomo98 in Juli 05, 2005, 10:00:45 VORMITTAG
I find it.
Thank you.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Sol in Juli 23, 2005, 12:26:03 NACHMITTAGS
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.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Jochus in August 04, 2005, 06:18:59 VORMITTAG
Thnx! This option is great!
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: pierse in August 04, 2005, 04:15:55 NACHMITTAGS
Zitat von: TarantinoArchives in Dezember 31, 2004, 07:58:38 VORMITTAG
Zitat
// 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!
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Xarcell in August 21, 2005, 03:37:26 NACHMITTAGS
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.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: edi67 in Oktober 02, 2005, 03:14:46 VORMITTAG
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.

???
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: TLM in Oktober 02, 2005, 11:58:15 NACHMITTAGS
Zitat von: edi67 in Oktober 02, 2005, 03:14:46 VORMITTAG
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%">
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: spaceman in Oktober 08, 2005, 02:54:07 VORMITTAG
Zitat von: TLM in Oktober 02, 2005, 11:58:15 NACHMITTAGS
Zitat von: edi67 in Oktober 02, 2005, 03:14:46 VORMITTAG
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
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Elmacik in Oktober 08, 2005, 02:57:09 VORMITTAG
i think this should be default in 1.1
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: shark in Oktober 15, 2005, 02:20:21 VORMITTAG
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?
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: TLM in Oktober 15, 2005, 12:51:22 NACHMITTAGS
Copy the MessageIndex from the default them, edit, and place in your themes directory...
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: dcmouser in Oktober 16, 2005, 09:16:42 NACHMITTAGS
thanks for this thread, works great.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: houston in Oktober 19, 2005, 09:24:59 NACHMITTAGS
Has anybody implememted this into smf 1.1 rc1? I am having trouble understanding what to put in and where.

Thanks
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: trenchteam in Oktober 20, 2005, 03:18:29 VORMITTAG
yep! works great.

I just followed the directions.

http://www.shoyoroll.com/forum
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: gerrymore in November 09, 2005, 12:16:31 NACHMITTAGS
Zitat von: houston in Oktober 19, 2005, 09:24:59 NACHMITTAGS
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.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Sverre in November 09, 2005, 01:03:05 NACHMITTAGS
Zitat von: gerrymore in November 09, 2005, 12:16:31 NACHMITTAGS
Zitat von: houston in Oktober 19, 2005, 09:24:59 NACHMITTAGS
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)
{
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: gerrymore in November 09, 2005, 02:09:41 NACHMITTAGS
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.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Sverre in November 09, 2005, 02:34:05 NACHMITTAGS
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%">
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: gerrymore in November 09, 2005, 03:00:35 NACHMITTAGS
Thanks Sverre, you're a star. I dont know what went wrong as my code and yours looked the same. Must have missed something.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: dairin in Dezember 04, 2005, 12:01:09 NACHMITTAGS
Zitat von: Xarcell in August 21, 2005, 03:37:26 NACHMITTAGS
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
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: kuklovod in Dezember 07, 2005, 03:56:54 VORMITTAG
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
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: CuTe_MaN in Dezember 08, 2005, 05:34:51 VORMITTAG
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
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Simplemachines Cowboy in Januar 29, 2006, 01:57:25 NACHMITTAGS
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.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Sol in Februar 01, 2006, 02:47:27 NACHMITTAGS
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.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: trenchteam in Februar 19, 2006, 02:11:00 VORMITTAG
Zitat von: Sverre in November 09, 2005, 02:34:05 NACHMITTAGS
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
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: cldnails in Februar 19, 2006, 10:30:34 VORMITTAG
What trenchteam said, works exactly the way I wanted.  Just required a little tweak for important thread to my personal favorite, sticky's. :) Thanks.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: nasty_b in März 14, 2006, 06:45:34 NACHMITTAGS
Is there a way to simply add the text "Sticky:" in front of the subject instead of having each sticky seperated? Thanks.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: tedgraves in April 10, 2006, 12:13:11 NACHMITTAGS
MessageIndex.template.php

I dont have that file! ant help please!!
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Kindred in April 10, 2006, 12:41:34 NACHMITTAGS
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.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: eriktm in April 10, 2006, 12:58:41 NACHMITTAGS
Zitat von: tedgraves in April 10, 2006, 12:13:11 NACHMITTAGS
I dont have that file! ant help please!!

Look in /Themes/default/
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: geezmo in April 24, 2006, 10:44:01 NACHMITTAGS
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.

Zitat
      // 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%">
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Vinspire^ in April 27, 2006, 03:32:38 VORMITTAG
Yeap. I am also having the same situation as geezmo. Anyone here got the answer ?
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Vinspire^ in April 28, 2006, 03:05:01 VORMITTAG
Someone please give the answer asap :(
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Vinspire^ in April 30, 2006, 10:39:37 NACHMITTAGS
Happy labour day ... had been waiting for an answer for about a week  :'(
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: TechnoDragon in Mai 02, 2006, 12:28:11 VORMITTAG
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
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Vinspire^ in Mai 02, 2006, 06:45:54 VORMITTAG
Zitat von: TechnoDragon in Mai 02, 2006, 12:28:11 VORMITTAG
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 :)
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: TechnoDragon in Mai 02, 2006, 09:17:09 VORMITTAG
Glad to be of help!
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Vinspire^ in Mai 02, 2006, 11:49:29 VORMITTAG
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)
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: TechnoDragon in Mai 02, 2006, 12:03:45 NACHMITTAGS
Good going!
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: L.G.S in Mai 12, 2006, 12:55:06 NACHMITTAGS
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?
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Sverre in Mai 12, 2006, 03:33:32 NACHMITTAGS
Zitat von: L.G.S in Mai 12, 2006, 12:55:06 NACHMITTAGS
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.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: L.G.S in Mai 12, 2006, 03:53:01 NACHMITTAGS
Changed it but it's made it worse :(

http://www.tactical-illusion.com/board/index.php?board=7.0
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Sverre in Mai 12, 2006, 04:30:07 NACHMITTAGS
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 :-\
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: L.G.S in Mai 12, 2006, 04:45:57 NACHMITTAGS
All I did was find the code from TML and replace it with your one :(
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Burtie in Mai 19, 2006, 09:54:13 VORMITTAG
Hi,

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

:)
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: karras.us in Mai 26, 2006, 12:18:48 VORMITTAG
Thanks TarantinoArchives & [Unknown], works like a charm.

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

Thanks again.  :D
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Jmecca2 in Juni 18, 2007, 01:37:17 VORMITTAG
thanks, just what i was looking for ;D
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: amirali.b in Juni 24, 2007, 03:44:33 NACHMITTAGS
Zitat von: Ben_S in September 05, 2004, 06:37:36 NACHMITTAGS
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.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: kill3r in Juni 29, 2007, 01:23:55 NACHMITTAGS
hey thanks, this tip works great.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: eugene_lazarev in September 21, 2007, 01:56:22 NACHMITTAGS
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)
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Neorics in September 22, 2007, 10:06:23 VORMITTAG
hey great tip, thanks for sharing!!!
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: jesuscamp1 in Oktober 07, 2007, 06:57:07 VORMITTAG
Zitat von: Ben_S in September 05, 2004, 06:37:36 NACHMITTAGS
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
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: hayley2007 in Oktober 29, 2007, 04:56:56 VORMITTAG
why doesnt Ben_s one work for me? im on 1.1.4 when i do the code change, nothing changes at all :/
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: ham1299 in November 02, 2007, 10:48:18 NACHMITTAGS
This is awesome. Worked very nicely! Thanks! :D
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Sarge in Dezember 09, 2007, 03:08:14 VORMITTAG
Zitat von: hayley2007 in Oktober 29, 2007, 04:56:56 VORMITTAG
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.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: seymoor in Dezember 18, 2007, 04:12:41 NACHMITTAGS
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...?
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Mick. in Dezember 23, 2007, 04:26:30 NACHMITTAGS
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?

Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Oldiesmann in Januar 19, 2008, 10:13:35 NACHMITTAGS
Zitat von: seymoor in Dezember 18, 2007, 04:12:41 NACHMITTAGS
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.

Zitat von: BlueDevil in Dezember 23, 2007, 04:26:30 NACHMITTAGS
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.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Mick. in Januar 20, 2008, 12:19:04 NACHMITTAGS
Thanx Oldiesmann.  Reply #2 worked.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Antechinus in November 30, 2008, 02:20:52 NACHMITTAGS
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.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Stuart in Dezember 26, 2008, 02:43:16 NACHMITTAGS
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?
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Kindred in Dezember 26, 2008, 04:49:38 NACHMITTAGS
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.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: coldfusionpower in Januar 17, 2009, 07:22:14 VORMITTAG
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: ?>
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: coldfusionpower in Januar 21, 2009, 12:23:20 NACHMITTAGS
someone please help me on this .. thanks ....
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Antechinus in Januar 21, 2009, 12:43:14 NACHMITTAGS
Attach the whole file. The error is somewhere else, because this hack doesn't touch the end of the file.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Lamarck in April 15, 2009, 04:17:45 NACHMITTAGS
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.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: STS in Juni 20, 2009, 12:13:03 VORMITTAG
Zitat von: [Unknown] in Oktober 01, 2004, 03:10:10 VORMITTAG

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.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: steve51184 in Januar 31, 2010, 10:28:30 NACHMITTAGS
anything like this for 2.0 rc2?
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Doc.Blade in Juli 07, 2011, 06:44:30 VORMITTAG
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
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: MrGrumpy in Juli 07, 2011, 08:26:04 NACHMITTAGS
A link would help to see exactly what you mean.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Doc.Blade in Juli 07, 2011, 10:12:37 NACHMITTAGS
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
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: MrGrumpy in Juli 08, 2011, 05:13:00 VORMITTAG
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.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Doc.Blade in Juli 08, 2011, 07:47:30 VORMITTAG
unfortunately titlebg comes up 32 times in my index.css file, dont know which one to change.  They are all colored #000
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: MrGrumpy in Juli 08, 2011, 09:04:06 VORMITTAG
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.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Kindred in Juli 08, 2011, 10:11:55 VORMITTAG
do note that that CSS also controls the display on a dozen other pages....
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: MrGrumpy in Juli 08, 2011, 10:16:59 VORMITTAG
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.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Doc.Blade in Juli 08, 2011, 11:16:52 VORMITTAG
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
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: MrGrumpy in Juli 08, 2011, 11:39:51 VORMITTAG
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.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Doc.Blade in Juli 11, 2011, 12:48:01 VORMITTAG
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
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: MrGrumpy in Juli 11, 2011, 10:59:16 VORMITTAG
Change the white or #ffffff hex colors to the orange color on the catbg css like how you changed the titlebg css
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Doc.Blade in Juli 11, 2011, 09:55:10 NACHMITTAGS
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
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: MrGrumpy in Juli 12, 2011, 04:55:38 VORMITTAG
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;
}
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: Doc.Blade in Juli 12, 2011, 10:52:28 VORMITTAG
Perfect, thank you so much for your help MrGrumpy, it is greatly appreciated!
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: MrGrumpy in Juli 14, 2011, 08:09:11 VORMITTAG
You're welcome Doc.
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: MaNaRa in August 04, 2011, 11:20:45 VORMITTAG
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?
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: MrGrumpy in August 04, 2011, 11:36:44 VORMITTAG
The spacing isn't right in that bit of code for the 2.0 file

search for

foreach ($context['topics'] as $topic)
Titel: Re: Separating the sticky topics from the normal ones
Beitrag von: MaNaRa in August 04, 2011, 12:12:52 NACHMITTAGS
ah ok, now works perfect! thanks MrGrumpy