Audio in sNews 1.6
This is the method I have used to add an audio player to sNews powered sites. It uses the 1pixelout.net MP3 player.Update: Since writing this article, I have migrated my homepage to the sNews CMS, and you can see the modification working on pages such as Latitude Festival 2007.
Note 1: It currently only works for files stored within your sNews site, not external MP3s. I could add that to the code if anyone wants it.
Note 2: The code below is lacking comments and tabs, which both would make the code easier to read. However, it seemed to make it more complicated for copy-and-pasting so it's been removed. Feel free to recomment the code in your sNews.php file, or ask me where things don't make sense.
- First, download the following files. (Right click and select 'Save As..')These files were created by the talented Martin Laine and released under the GNU GPL.
- Upload these two files into the folder: http://yoursite.com/audio-player/
- Add or amend the following lines of your snews.php file, where line number refer to the original sNews 1.6 file.
Change Line 244 to:
After Line 246, add these lines:
- Now, run down to Line 1849 or search for FILE INCLUSION. You will replace the file_include function with the following two functions:
- That should be it. Now upload an MP3 to your site using the sNews Upload feature, and you can use the Include function to create a link to the file, such as: [include]files/music.mp3[/include]
- This will create a player for each included mp3 file. That's it - send me some feedback, let me know if it works for you!