My Very First Php Experience

February 9th, 2007

.

Today I had my very first php experience, where I created something from scratch instead of modifying some pre-existing bit of code.

The project was to create a snippet for the Etomite CMS. What I needed for a client was a simple but effective way to play an mp3 in the browser page. Not being a programmer in the very least, I avoided the dreaded actionscripting experience and went online to look for a good quality flash-based mp3 player. Why invent the wheel, right? I found just the thing at SourceForge.net. Some genius there named Fabricio Zuardi created a very nice player.

After taking it and figuring out how to get it to work, I changed the flash embed code to be XHTML compliant and uploaded it for testing. It worked and I was able to change the track simply by altering the display code, so I opened up Notepad++ and proceeded to learn just enough php to do this thing.

After a brief overview at Etomite’s snippet creation documentation, I went online and found a good page about the very (very) basics of php.

I think the toughest part was the syntax. Figuring out how double and single-quotes worked was one particular breakthrough that a php pro might snicker at. I also had a tough time getting my variables to pass and display correctly.

My process was to make the simplest code possible to see how things worked. I would change one character at a time and see the results. Slow and painful, but it worked!

You can see the results here.

Bookmark and Share
Share and Enjoy:
  • del.icio.us
  • Digg
  • StumbleUpon
  • Technorati
  • Reddit
  • Slashdot
  • LinkedIn
  • Print
  • Twitter
  • email

2 Responses to “My Very First Php Experience”

  1. Ade Says:

    Great start. I recommend you checkout heredocs (http://php.net/heredoc) as an alternate way to output large blocks of text. It’s a lot easier to read/write and you don’t have to mess with escaping the double quotes in your HTML.

    Your code ends up like this: http://www.adeolonoh.com/code/iansmith_mp3player.php.txt (I didn’t figure the code would re-display well in the comment)

  2. Ian Says:

    That is really cool, thanks for sharing!

Leave a Reply