TinyPortal

Development => Block Codes => Topic started by: domineaux on November 09, 2007, 08:25:35 PM

Title: Sound plays only first few seconds after site opens
Post by: domineaux on November 09, 2007, 08:25:35 PM
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.

Title: Re: Sound plays only first few seconds after site opens
Post by: Lesmond on November 09, 2007, 08:40:33 PM
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:
Title: Re: Sound plays only first few seconds after site opens
Post by: JPDeni on November 09, 2007, 08:45:17 PM
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.
Title: Re: Sound plays only first few seconds after site opens
Post by: domineaux on November 09, 2007, 09:37:22 PM
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.



Title: Re: Sound plays only first few seconds after site opens
Post by: JPDeni on November 10, 2007, 01:18:12 AM
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'.
Title: Re: Sound plays only first few seconds after site opens
Post by: Ianedres on November 10, 2007, 07:47:01 AM
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...