TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

April 30, 2024, 07:36:01 AM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,174
  • Total Topics: 21,220
  • Online today: 147
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 117
  • Total: 117

Sound plays only first few seconds after site opens

Started by domineaux, November 09, 2007, 08:25:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

domineaux

I've got this cheesy little sound about 10 seconds that I need to play each time the forums is opened.

Where do I poke the code..


<embed src="Sounds/cheesysound.wav" hidden=true>
</embed>


If you don't like my code, give me your suggestion.

I tried in the index.template.php file and got a parse error.

I don't want the site visitor to have any control over the sound.


Lesmond

You could try it in a block, then you would have control over who it will play too, not sure how to code it though  :idiot2:

JPDeni

Where did you try to put it in index.template.php? It can go there, but you have to have the syntax correct. If you could post some lines before and after where you put it, we might be able to help you get the syntax correct.

domineaux

I'm not sure it will work inside the index.template.php, because everytime you refresh the screen you get the sound.

I just put the code snippet in the header behind the JS.   It does sound off, but everytime you do something that refreshes the board the sound activates.  Doing just about anything with a click when you're inside the boards the sound goes off.

I was hoping to find a way to get it to work... ONLY when the site is opened to start. 

I relialize it works in a block, but that's not what I need.




JPDeni

QuoteI was hoping to find a way to get it to work... ONLY when the site is opened to start.
I don't think that's going to happen, even with a block. You would have to somehow keep track of whether the sound had already played, such as checking a cookie or a database entry when the file loads. If it didn't show that it had played, then it would play the sound and write to the cookie and if it had, it wouldn't play. Really complicated. I can tell you how it's done, but I wouldn't be able to write the code to do it.

If I visited your site and a sound played even once, I wouldn't come back. Just sayin'.

Ianedres

Definitely an easy way to discourage people from visiting too many of your pages.

I could see a possible use when entering a particular section or forum in your site, but only on a very limited basis for the initial entry...