News:

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

Main Menu

Sticky First Post (extends sticky topic)

Started by kuklovod, December 16, 2005, 01:21:28 AM

Previous topic - Next topic

kuklovod

Link to Mod

Fully reversible (uninstalls cleanly).

This modification extends basic sticky topics by stickying first post (it will be displayed on each page of multi-page topic) and adding a separator between sticky and non-sticky topics and posts.
No option to turn it on or off - automatically turned on for sticky topics.
Performance drawbacks: extra query (one quick first post select) only for topics marked as sticky.
Known bugs: post counter in a topic is offset by one on each page after first, since first post is inserted. Does not affect anything.

Version: 1.3.1
  - Support for "newest first" sorting order - sticky post will be first anyway.

Version: 1.3.0
  - 1.1 (and further) compliant
 
Version: 1.2.3
  - Made 1.0.8+ and 1.1 RC3 compliant

Version: 1.2.2
  - Joined all installs into one file
  - Babylon theme is now modified in RC2 as well (previous default)

Version: 1.2.1
  - Don't print "Sticky topics" on a page with no stickies
  - Verified that mod works with 1.0.7 (use 1.0.5 version) and latest 1.1RC2 update.

Version: 1.2
  - Modifies classis theme, too
  - Added text for both sticky and non-sticky topic headers to language dir
  - Support for 1.1RC2 release of SMF

Version: 1.1
  - Released for 1.0.5
  - Install/uninstall cleanly

Version: 1.0
  - Released for 1.1 RC1

Originally requested here: http://www.simplemachines.org/community/index.php?topic=23726.0
Sample here, browse stickied topics (Russian, but you can get the idea - default theme): http://pooltalk.spb.ru/board,1.0/

mforum

is it possible to have a version that works on SMF 1.0.5 classic theme??

:) Nice mod anyway ...!!!!!

Azumi_chan

Great mod, although it doesn't work on the theme I am currently using (Daze Skin (Blue)). Would mean the world if it was possible to fix this! :)

Link to theme: http://www.simplemachines.org/community/index.php?topic=24950.0

kuklovod

#3
I've tested on default themes for 1.0.5 and 1.1RC1, I can adapt to other themes if you post their MessageIndex.template.php and Display.template.php zipped up somewhere.

Azumi, I looked at the theme you mention and I see that the 1.0.5 version should install correctly on it. Do you get any problems installing? Which forum version? Which files show errors installing?

Azumi_chan

Version Information:
Forum version: SMF 1.0.5
Current SMF version: SMF 1.0.5
(more detailed)


I had no problem installing, I've tried other themes and it works great for them, just not the "Daze" series >.<

kuklovod

#5
I guess I see your point. It installs on the default theme, while Daze theme have custom versions of MessageIndex.template.php and Display.template.php. You will need to do manual replace on those files for your theme, open up install.xml from the mod package, and then look at the pieces of code starting with "search position="replace"", find them in the corresponding .template.php file, and replace with contents of the following <add> clause :) If that's too hard, post your .template.php and i'll do it for you :)

mforum

i did that on classic theme, stickys seperated from others allright but only in first page, is this the way your mod works?  in that case not really sticky eh?  ;)

Azumi_chan

Quote from: kuklovod on December 19, 2005, 03:37:44 AM
I guess I see your point. It installs on the default theme, while Daze theme have custom versions of MessageIndex.template.php and Display.template.php. You will need to do manual replace on those files for your theme, open up install.xml from the mod package, and then look at the pieces of code starting with "search position="replace"", find them in the corresponding .template.php file, and replace with contents of the following <add> clause :) If that's too hard, post your .template.php and i'll do it for you :)

It would be very darling of you to do it for me :)
My messageindex+display template -> http://s65.yousendit.com/d.aspx?id=18SGUZOI0HWI00K4AKPUI3L58V [nofollow]

Just send them to: [email protected] when you're done :D

kuklovod

#8
mforum, I see what you mean. Sticky topics do not appear on second page of topics and further, right? I tried to do it but it would require a some database changes OR a major slowdown for additional very intensive query, which I both try to avoid to be as compatible as possible. The current topic select DB query is very strict and hardly fixable, I would have to pull in all of the topics since stickied ones are in the very beginning, so for a board with say 150 pages of topics it would be a killer. Still looking for a way to maybe modify the existing query somehow, but I really doubt it's possible.


Azumi, fixed files available here: http://s22.yousendit.com/d.aspx?id=2IN3ZXVWFSZID22HLQXV9WJEBJ

Save originals for backup, and please let me know if it worked allright or not.

Azumi_chan


mforum

Quote from: kuklovod on December 19, 2005, 03:39:44 PM
mforum, I see what you mean. Sticky topics do not appear on second page of topics and further, right? I tried to do it but it would require a some database changes OR a major slowdown for additional very intensive query, which I both try to avoid to be as compatible as possible. The current topic select DB query is very strict and hardly fixable, I would have to pull in all of the topics since stickied ones are in the very beginning, so for a board with say 150 pages of topics it would be a killer. Still looking for a way to maybe modify the existing query somehow, but I really doubt it's possible.

I am not much of a coder but i know what you mean  :)
Another thing is that sticky`s dont have "Sticky" above them, but other topics have "non sticky topic" above them, it would be nice to fix that as it would be nicer in "view"...I also suggest to put a modofication for classic theme too, as it is a theme build in SMF... :)
Thanks a lot  :)

kuklovod

You're right, adding "Sticky topics" too. I'd look how to modify classic theme as well, as I currently use $themedir for installation, I thought it installs the mod for the currently default theme.

mforum

Quote from: kuklovod on December 21, 2005, 05:14:35 AM
I'd look how to modify classic theme as well, as I currently use $themedir for installation, I thought it installs the mod for the currently default theme.

It should be but it doesnt... actually make changes at themes/deafault/.... but classics dir is themes/classic/....   :)

kuklovod

version 1.2 should install on both classic and default themes and use sticky/non-sticky wording for topic headers from language file :)

snork13

cool mod, anyway to make this so even the topic not set to sticky get the first post shown throughout the thread?

thanks

-snork
Mods
Please DO NOT PM me with requests for individual support, but post your questions and concerns in the appropriate section of the forum where other users can benefit from them as well. Thank you.
I have been super busy as of late. Working on updates to all my modifications for 2.0.1

kuklovod

For now, you can manually modify two files: first, edit Sources/Display.php:

find "// always get post number 0 for sticky topics"
on next line after it remove "&& $context['is_sticky']"

And then, edit Themes/(yourtheme)/Display.template.php:

find "</td></tr>';"
on next line after it, remove "$context['is_sticky'] && "

This way, first post will be sticky for all topics. I will make it into a topic option someday, but it requires extra topic moderator options which is alot of changes with permissions etc :)

mforum

Quote from: kuklovod on December 21, 2005, 07:34:45 AM
version 1.2 should install on both classic and default themes and use sticky/non-sticky wording for topic headers from language file :)

Installs fine, works fine, uninstalls fine.......
Great work great support,, thanks a lot...!!!  :)

Unnamed~

I need some help. When i add this code in Display.template.php i receipt an error:

if($context['is_sticky'] && ($message['id']==$context['topic_first_message'])) {
echo '<tr><td class="titlebg" style="padding: 3px 0px;">&nbsp;</td></tr>';
}


I use the 1.0.5 vercion of SMF and SMFGeneration theme.
· DConsolas.com.ar - Consolas made in Argentina ·

kuklovod


Unnamed~

Somthing like that:

Quotetemplate pase error in Display.template.php
· DConsolas.com.ar - Consolas made in Argentina ·

Advertisement: