This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-11-10 03:58:54

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

HOWTO: Make a webpage play music automatically in PHP

Just insert this code:

Code:

<?php echo "<iframe src=\"MUSIC_FILE_LINK\" width=\"0\" height=\"0\"></iframe>"; ?>

Action:
Plays the MUSIC_FILE_LINK part on the webpage.
Effects:
A tiny square about 1x1 will still be visible somewhere on the page.

Last edited by WindowsExplorer (2011-11-10 04:00:25)


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#2 2011-11-10 04:06:53

ssss
Scratcher
Registered: 2007-07-29
Posts: 1000+

Re: HOWTO: Make a webpage play music automatically in PHP

CSS to make that dissappear:

style hidden
yeah.


Hey.  It's me SSSS, back from the dead!  smile

Offline

 

#3 2011-11-10 07:12:40

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: HOWTO: Make a webpage play music automatically in PHP

Since the Scratch fora aren't the place to really share things like this I'm not sure whether the How To guide fits... However, I do see your point in the how-to since a lot of people learn about web languages on this forum.

There seem to be a lot of threads here now asking questions about PHP, MYSQL, JS etc as well as guides so maybe it would be a good idea to reduce clutter by bringing them into one thread where everyone can ask web-language questions or share their discoveries as tutorials? I'll set one up and see how it goes.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#4 2011-11-10 11:37:55

TRocket
Scratcher
Registered: 2009-08-18
Posts: 1000+

Re: HOWTO: Make a webpage play music automatically in PHP

this is html not php


http://i.imgur.com/1QqnHxQ.png

Offline

 

#5 2011-11-10 11:38:35

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: HOWTO: Make a webpage play music automatically in PHP

TRocket wrote:

this is html not php

Yes, but it also helps to know how to do it in php.


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#6 2011-11-10 13:07:00

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: HOWTO: Make a webpage play music automatically in PHP

TRocket wrote:

this is html not php

I agree. It's HTML placed inside an echo.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#7 2011-11-10 13:09:19

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: HOWTO: Make a webpage play music automatically in PHP

sparks wrote:

TRocket wrote:

this is html not php

I agree. It's HTML placed inside an echo.

This way you can insert variables into the link or things.


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#8 2011-11-10 13:56:38

gbear605
Scratcher
Registered: 2008-03-06
Posts: 1000+

Re: HOWTO: Make a webpage play music automatically in PHP

Something cool I made with this:

http://escratch.org/MusicPlayer/index.html

BTW, this uses iframes a TON  tongue

An example music file:

http://escratch.org/MusicPlayer/Minecraft_3_6_and_a_half_songs.mid

Last edited by gbear605 (2011-11-10 13:57:25)


Yeah, I'm mostly inactive.  I check in once in a while though.  If you want to contact me, I have a contact form at my website, http://escratch.org

Offline

 

#9 2011-11-10 14:00:21

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: HOWTO: Make a webpage play music automatically in PHP

gbear605 wrote:

Something cool I made with this:

http://escratch.org/MusicPlayer/index.html

BTW, this uses iframes a TON  tongue

An example music file:

http://escratch.org/MusicPlayer/Minecraft_3_6_and_a_half_songs.mid

Coool! There's the advantage of using PHP! Also, may I suggest using GET functions for the music insted of post? That way people can link to your music player (well, it's actually the browser's default mp3 player, but still  tongue )


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#10 2011-11-10 14:09:25

gbear605
Scratcher
Registered: 2008-03-06
Posts: 1000+

Re: HOWTO: Make a webpage play music automatically in PHP

WindowsExplorer wrote:

gbear605 wrote:

Something cool I made with this:

http://escratch.org/MusicPlayer/index.html

BTW, this uses iframes a TON  tongue

An example music file:

http://escratch.org/MusicPlayer/Minecraft_3_6_and_a_half_songs.mid

Coool! There's the advantage of using PHP! Also, may I suggest using GET functions for the music insted of post? That way people can link to your music player (well, it's actually the browser's default mp3 player, but still  tongue )

It actually does use get, BUT its in an iframe so you can't see it.  That ay you don't have to switch pages.  I did that, because I'm making a thing that combines this, my scratch viewer, and my youtube viewer, and a few other things.

If you want non-iframe, just go to http://escratch.org/MusicPlayer/form.html

EDIT: My combination thing  tongue
Here
It was going to have a scratch viewer, but it wasn't working for some reason.

Last edited by gbear605 (2011-11-10 14:22:32)


Yeah, I'm mostly inactive.  I check in once in a while though.  If you want to contact me, I have a contact form at my website, http://escratch.org

Offline

 

Board footer