News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Hack: new message flashing icon

Started by marten, January 12, 2006, 08:40:11 PM

Previous topic - Next topic

marten

A little useful hack for the new Core Theme (NDT).

When you get a message you'll se a fashing icon next to the message button in the top menu.
Without this flashing icon it is hard to notice when u get a message, at least for me  ;)


Find index.template.php in Themes/default
// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo ($current_action == 'pm' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'pm' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '</a>

Replace with:
// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo ($current_action == 'pm' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'pm' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]&nbsp;&nbsp;<img src="' . $settings['images_url'] . '/newpm.gif" border="0" />' : '' , '</a>


You also need the flashing image newpm.gif and upload that to Themes/default/images.

I put the one I use here, so just right click on it and save it to your computer.

  

http://www.hellasob.com/w3timages/newpm.gif [nofollow]
\_Marten

Simplemachines Cowboy

Absolutely way cool.

Thanks for doing this!
My SMF forum: The Open Range

1MileCrash

who made that icon? it looks very familiar...
The only thing php can't do is tell you how much milk is left in the fridge.



Bigguy

we could use any flashing icon though right ? and yep it does look familiar, just dont know from where.

snork13

Quote from: Bigguy on January 12, 2006, 09:40:57 PM
we could use any flashing icon though right ? and yep it does look familiar, just dont know from where.

yes, and it's already in tip and tricks...which is why it looks familiar..i use this one -->
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

marten

Quote from: Bigguy on January 12, 2006, 09:40:57 PM
we could use any flashing icon though right ? and yep it does look familiar, just dont know from where.
Yes you can use any icon you want, just remember to name it right  or rename the image in the code.

Well I have seen that icon in many places too, I just used Google and found some and did choose this one  :D
\_Marten

marten

Quote from: snork13 on January 12, 2006, 09:45:11 PM
Quote from: Bigguy on January 12, 2006, 09:40:57 PM
we could use any flashing icon though right ? and yep it does look familiar, just dont know from where.

yes, and it's already in tip and tricks...which is why it looks familiar..i use this one -->
It is in tip and trick?? You mean a hack for RC2 NDT ..?  Anyway  your icon looks so much nicer so I think I will use that one instead :)
\_Marten

Bigguy

I just put it on my board and it works like a charm. Thanks for this. :)

Dexy

#8
I cant find
// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo ($current_action == 'pm' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'pm' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '</a>

in index.template.php

p.s. i am using macvision theme, is that problem?

psychophat

Can this be used also in the default SMF theme?
I adore this forum, from zero PHP knowledge to +.1% per post
I'm going to get the charter member thinggy when I get to save some cash
SMF v.1.1RC2
PHP v.4.3.11

Bigguy

I used this on the default smf 1.1 RC2 theme and it works fine.

psychophat

Way cool I'm going to put it right away.
I adore this forum, from zero PHP knowledge to +.1% per post
I'm going to get the charter member thinggy when I get to save some cash
SMF v.1.1RC2
PHP v.4.3.11

Bigguy

Theres also one around that plays a sound file "You`ve got mail" when you recieve a PM.

marten

#13
Hello again.

It is rather simple if you also want the sound "You`ve got mail" also.
In the code here i have used the IE tag "bgsound", but bgsound is a proprietary IE tag it isn't W3C standard so it won't work in Firefox, it should work in Opera though.

To allow playback of bgsound or embedded tags in Firefox you need an extension/plugin.

look for the same code as above. ( Still this is only for the New Default Theme for 1.1 RC2 )

Find index.template.php in Themes/default
// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo ($current_action == 'pm' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'pm' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '</a>


Replace with:
// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo ($current_action == 'pm' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'pm' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]&nbsp;&nbsp;<img src="' . $settings['images_url'] . '/newpm.gif" border="0"><bgsound src="' . $settings['images_url'] . '/mail.wav" border="0">' : '' , '</a>


I have used a WAV file in this example called  "mail.wav"  so don't forget to change the name to what u want.

Upload the mail.wav file to Themes/default/images

You can find "You`ve got mail" wav files at this site (  I use - Mail03.wav Typical, "You've got mail". )

http://www.ilovewavs.com/Events/GotMail/GotMail.htm [nofollow]



\_Marten

Bigguy

Psyclones has made a hack to almost the same as this, he also has one I do believe for playing swf instead of wav. Which means of course no plugin is necessary, thats always nice.

Dexy

I have SMF 1.0.5. is there any hack for this version?
tnx

marten

Quote from: Dexy on January 15, 2006, 05:26:37 AM
I have SMF 1.0.5. is there any hack for this version?
tnx

Yes it is Tips and Tricks, at least I think it is for 1.05 , as someone pointed out here above ( I have never used that version myself ).
http://www.simplemachines.org/community/index.php?topic=9017.0
\_Marten

marten

Quote from: Bigguy on January 14, 2006, 09:20:00 PM
Psyclones has made a hack to almost the same as this, he also has one I do believe for playing swf instead of wav. Which means of course no plugin is necessary, thats always nice.

If so and it works with swf it will be a better choice ( havn't checked the hack ) , I don't use sound on my own board, only the animated icon, and u are right IF users have SWF turned on. Many users have that function turned OFF in their browers, because so many don't like SWF.. so my little hack work with most browsers except for Firefox witout a downloadable addon/extension to support BGSOUND. I dont't like sites either threre u visit websites with background musik, often MIDI files, and u can't turn it off BUT there are so many sites out there that uses bgsound and u can't hear the music then.

https://addons.mozilla.org/extensions/moreinfo.php?id=146 [nofollow]
\_Marten

FBI

I have bad idea. For guest visitor, playing the applause.wav.
Visitor who didnt register/login into forum, they will heard applaus sound :)
Its weird and feel bad (I think). But useful, you can push visitor to register into your forum.

Here the code

Go find the code inside /Themes/index.template.php
// Otherwise they're a guest - so politely ask them to register or login.
else
{
echo '
', $txt['welcome_guest'], '<br />
', $context['current_time'], '<br />';
        }


And add this code
Quoteecho '<bgsound src="http://www.yoursite.com/Applause.wav" border="0">';

And the full code are:
// Otherwise they're a guest - so politely ask them to register or login.
else
{
echo '
', $txt['welcome_guest'], '<br />
', $context['current_time'], '<br />';
              echo '<bgsound src="http://www.yoursite.com/Applause.wav" border="0">';
}


Get the wav here
Get the sample result at my forum here

Tested on IE and Opera

Its Bad Idea or Good idea? ;D

PS: You can record your own voice that speak "Welcome to my forum, please login.. bla.. bla.. bla"

Xerxes

#19
I just added this to 1.1 RC2 and it works great. It's the simple things that make communication more effective. Thanks.

Advertisement: