News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

TIP: add HOT icon for hot topics

Started by IdanC, May 18, 2010, 06:24:42 AM

Previous topic - Next topic

IdanC

want to draw more attention to your popular discussions by marking them with this sexy little icon - ?

edit MessageIndex.template.php, search for
// Is this topic new? (assuming they are logged in!)
if ($topic['new'] && $context['user']['is_logged'])
echo '
<a href="', $topic['new_href'], '" id="newicon' . $topic['first_post']['id'] . '"><img src="', $settings['lang_images_url'], '/new.gif" alt="', $txt['new'], '" /></a>';


and after that add:
// Is this topic hot?
if ($topic['replies']>=$modSettings['hotTopicPosts'])
echo '
<img src="', $settings['images_url'], '/hot.gif" alt="HOT" />';


you can adjust the number of replies that triggers the icon through admin --> Posts and Topics --> Topic Settings --> Number of posts for a hot topic, just don't forget to add the hot.gif file to your image folder.

good luck  :)

Arantor

You know SMF already changes the far left icon for hot topics?
Holder of controversial views, all of which my own.


IdanC

yea, but it's barely noticeable, especially by new-comers.

but this icon makes the topic stand out much more. I've been using it for a month now, and there is a significant improvement in the popularity (both views and replies) of hot topics.

Arantor

You may as well use $modSettings['hotTopicPosts'] instead of 10, because then not only is it consistent with the other thing (you could just set that to use the hot icon, of course!), it's also configurable from the ACP without touching any further code.
Holder of controversial views, all of which my own.


IdanC

good one, thanks!

for anyone who wonders, setting the $modSettings['hotTopicPosts'] is done through admin --> Posts and Topics --> Topic Settings --> Number of posts for a hot topic

Dzonny

Topic moved.

Thanks for sharing tip :)

MakeItWork

Quote from: IdanC on May 18, 2010, 06:24:42 AM
if it's good enough, i hope someone can move this discussion to the Tips and Tricks board

want to draw attention to your popular discussions by marking them with this sexy little icon - ?

edit MessageIndex.template.php, search for
// Is this topic new? (assuming they are logged in!)
if ($topic['new'] && $context['user']['is_logged'])
echo '
<a href="', $topic['new_href'], '" id="newicon' . $topic['first_post']['id'] . '"><img src="', $settings['lang_images_url'], '/new.gif" alt="', $txt['new'], '" /></a>';


and after that add:
// Is this topic hot?
if ($topic['replies']>=10)
echo '
<img src="', $settings['images_url'], '/hot.gif" alt="', $txt['hottopic'], '" />';


you can adjust the number of replies that triggers the icon, just don't forget to add the hot.gif file to your image folder.

good luck

Thank you for this! :]

~DS~

"There is no god, and that's the simple truth. If every trace of any single religion were wiped out and nothing were passed on, it would never be created exactly that way again. There might be some other nonsense in its place, but not that exact nonsense. If all of science were wiped out, it would still be true and someone would find a way to figure it all out again."
~Penn Jillette – God, NO! – 2011

Arantor

A similar check against $modSettings['hotTopicVeryPosts'].
Holder of controversial views, all of which my own.


~DS~

Thank you Arantor, much appreciated, and no I am not using on my forum, was testing it on my dev site.
Anyone wondering how:
// Is this topic very hot?
if ($topic['replies']>=$modSettings['hotTopicVeryPosts'])
echo '
<img src="', $settings['images_url'], '/hot.gif" alt="HOT" />';
"There is no god, and that's the simple truth. If every trace of any single religion were wiped out and nothing were passed on, it would never be created exactly that way again. There might be some other nonsense in its place, but not that exact nonsense. If all of science were wiped out, it would still be true and someone would find a way to figure it all out again."
~Penn Jillette – God, NO! – 2011


divecall

Nice idea, indeed.

Thank you.

I have a nice grafix for "very hot topics", but i wonder, why i never can attached the file here ! ? !

~DS~

any hosting image site can do and link it here. ;)
"There is no god, and that's the simple truth. If every trace of any single religion were wiped out and nothing were passed on, it would never be created exactly that way again. There might be some other nonsense in its place, but not that exact nonsense. If all of science were wiped out, it would still be true and someone would find a way to figure it all out again."
~Penn Jillette – God, NO! – 2011

divecall

Well, not the answer, i was waiting for, but OK.

Here it is...a chilli pepper !!!



http://www.abload.de/image.php?img=chilli25qf.jpg

;D ;D ;D

(Why not !)

IdanC

Quote from: divecall on May 21, 2010, 04:13:25 PM
Here it is...a chilli pepper !!!



so funny, i'm going to use it!

thanks  :)

divecall

can you tell me the code, what i need to change ?

(I have only the grafx, not the experience... :o)

IdanC

are you serious?


if something
   do something...


if you can understand the above, i'm sure you can manage this very simple and self-explanatory two lines of code.

nikki73

Hi

im abit new to all this but just wanted to ask, ive added this Hot Topic to my forum but the actual icon isnt coming up, only the word HOT, any ideas why??

I have 2.0 version

Many thanks

IdanC

if you'll take a look at this line

<img src="', $settings['images_url'], '/hot.gif" alt="HOT" />';

you'll see the alt="HOT", which means that the alternative to the picture is the word "HOT". that happens whenever the image itself can't be found. make sure that the src tag points to an image (or more specifclly - that a file called "hot.gif" is present in your image folder)

nikki73

Right thanks for that, im now running off to have a look lol  ;)

nikki73

Sorry to sound thick but is the image folder in the cpanel?? If it is then i think i found it but thees no hot.gif so i'l have to add it.

Can you tell me how to do this please lol

Im determined to learn all this even if it kills me hahaha

IdanC

uploading a file to a directory in your server is probably the most basic thing in web designing, i'm surprised you got so far. it's in the first page of every manual of every hosting service, pull your shxt together.

nikki73

 :o sorry i asked, ive done it now but will in future ask elsewhere

Advertisement: