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 :)
I remember telling Owdy how to do this one. Where did that topic go?
-[Unknown]
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.
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> </td>
<td colspan="5">' . $txt[70] . '</td>
</tr>' : '';
$previousTopicClass = $topic['class'];
I would make it:
if (isset($previousTopicClass) && strpos($previousTopicClass, 'sticky') !== false && !$topic['is_sticky'])
echo '
<tr>
<td> </td>
<td colspan="5">' . $txt[70] . '</td>
</tr>';
$previousTopicClass = $topic['class'];
-[Unknown]
This is just excellent :D Thanks all !
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
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"> </td>
<td colspan="7"> </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
Thanx all, that was for me :)
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! :)
http://www.simplemachines.org/community/index.php?topic=16265.0
merged topics ..
can someone clarify this file name tho? MessageIndex.template.php - I'm not finding a template.php
ahhh I found it, taking me a bit to get use to the smf file system
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"> </td>
<td colspan="7"> </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?
if (isset($previousTopicClass) && strpos($previousTopicClass, 'sticky') !== false && !$topic['is_sticky'])
echo '
<tr class="titlebg" style="font-size: 1ex;">
<td colspan="2"> </td>
<td colspan="7"> </td>
</tr>';
$previousTopicClass = $topic['class'];
-[Unknown]
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
Try removing the parts.
-[Unknown]
oh ya.... I'm tired, and should go to bed.
Thanks again guys
I'll try to use this trick, thanks guys!!
i put it on my board also. looks nice :D
Diplomat: You might want to upgrade so SMF RC2 ?
i was thinking of waiting til 1.0 final to upgrade, unless thats not a wise thing to do ???
Wow. Nice work!
Cool, worked a treat.
Thanx
8)
cant seem to find messageindex.template.php
it should be in your template folder
Quote
if (isset($previousTopicClass) && strpos($previousTopicClass, 'sticky') !== false && !$topic['is_sticky'])
echo '
<tr class="titlebg">
<td colspan="2"> </td>
<td colspan="7"> </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?
Can you post three lines above and below where you're putting that code, please?
-[Unknown]
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
Don't replace, add after.
-[Unknown]
Quote from: [Unknown] on December 31, 2004, 09:40:18 AM
Don't replace, add after.
-[Unknown]
i'll be damned, hehe.
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> </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!
Sure, just copy said headers from the code above that.
-[Unknown]
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...
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]
Wooohooo Awsome thanks! :)
is there a way to include global announcements in this too ?
http://mods.simplemachines.org/index.php?mod=78
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
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
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]
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
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.
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 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
I love you Ben :) :P
Meanwhile, which one true? (from codes?)
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
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)
This works great on my forums :).
-Dan The Man
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 :)
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;
}
I find it.
Thank you.
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.
Thnx! This option is great!
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!
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.
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.
???
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%">
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
i think this should be default in 1.1
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?
Copy the MessageIndex from the default them, edit, and place in your themes directory...
thanks for this thread, works great.
Has anybody implememted this into smf 1.1 rc1? I am having trouble understanding what to put in and where.
Thanks
yep! works great.
I just followed the directions.
http://www.shoyoroll.com/forum
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.
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)
{
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.
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%">
Thanks Sverre, you're a star. I dont know what went wrong as my code and yours looked the same. Must have missed something.
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
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
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
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.
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.
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
What trenchteam said, works exactly the way I wanted. Just required a little tweak for important thread to my personal favorite, sticky's. :) Thanks.
Is there a way to simply add the text "Sticky:" in front of the subject instead of having each sticky seperated? Thanks.
MessageIndex.template.php
I dont have that file! ant help please!!
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.
Quote from: tedgraves on April 10, 2006, 12:13:11 PM
I dont have that file! ant help please!!
Look in
/Themes/default/
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%">
Yeap. I am also having the same situation as geezmo. Anyone here got the answer ?
Someone please give the answer asap :(
Happy labour day ... had been waiting for an answer for about a week :'(
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
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 :)
Glad to be of help!
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)
Good going!
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?
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.
Changed it but it's made it worse :(
http://www.tactical-illusion.com/board/index.php?board=7.0
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 :-\
All I did was find the code from TML and replace it with your one :(
Hi,
Could anyone tell me how to change just the background colour of a sticky topic?
:)
Thanks TarantinoArchives & [Unknown], works like a charm.
I had to remove one of the <td colspan="2">, but everythings looks perfect.
Thanks again. :D
thanks, just what i was looking for ;D
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.
hey thanks, this tip works great.
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)
hey great tip, thanks for sharing!!!
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
why doesnt Ben_s one work for me? im on 1.1.4 when i do the code change, nothing changes at all :/
This is awesome. Worked very nicely! Thanks! :D
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.
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"> </td>
<td colspan="7"> </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...?
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?
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"> </td>
<td colspan="7"> </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.
Thanx Oldiesmann. Reply #2 worked.
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.
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?
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.
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: ?>
someone please help me on this .. thanks ....
Attach the whole file. The error is somewhere else, because this hack doesn't touch the end of the file.
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.
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"> </td>
<td colspan="7"> </td>
</tr>';
$previousTopicClass = $topic['class'];
-[Unknown]
This worked FANTASTIC. I removed the and that gave me the exact divider size I wanted. Thanks much.
anything like this for 2.0 rc2?
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
A link would help to see exactly what you mean.
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
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.
unfortunately titlebg comes up 32 times in my index.css file, dont know which one to change. They are all colored #000
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.
do note that that CSS also controls the display on a dozen other pages....
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.
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
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.
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:
- Category titles
- Info Center title
When you go into a category:
- the Subject / Started by
- Replies / Views
- Last post
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
Change the white or #ffffff hex colors to the orange color on the catbg css like how you changed the titlebg css
Awesome, that got all of them, except for when you go into a category:
- the Subject / Started by
- Replies / Views
- Last post
Do you know which one that will be?
Thank you so much for your help so far, it has been invaluable!
Doc
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;
}
Perfect, thank you so much for your help MrGrumpy, it is greatly appreciated!
You're welcome Doc.
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?
The spacing isn't right in that bit of code for the 2.0 file
search for
foreach ($context['topics'] as $topic)
ah ok, now works perfect! thanks MrGrumpy