html tag in nowplaying.txt

danielpoulin

New member
In nowplaying.txt, is it possible to put the name of the artist and the abum, one below the other?

can we changed nowplaying.txt with html tag?
 
danielpoulin said:
In nowplaying.txt, is it possible to put the name of the artist and the abum, one below the other?

can we changed nowplaying.txt with html tag?
The format is currently fixed. If you're using this file on your web site, then it's better to switch to XML, parse it and display in the format you like.
 
danielpoulin said:
how i can parse and display this?
It depends on how your web site is created. If you're using PHP - it has routines to parse XML data.
 
Thank you for your help!

I got a wordpress website, can you show me an example to show "name of artist" and a "title of a song:?

Thank you!
 
danielpoulin said:
I got a wordpress website, can you show me an example to show "name of artist" and a "title of a song:?
I'm not sure if easy and quick solution exists for Wordpress. How are you displaying the title now?
 
Hi

In wordpress, we can add a text block, also a html or a php code in a widget.

Now i use a <iframe>

Thank you for your help!
 
You can parse XML using PHP. I don't have the code handy, but you can find examples here: http://php.net/manual/en/function.xml-parse-into-struct.php
Please let me know if you need more information about it.
 
Thank you for your help

i found something in another website.

I created a php file and i put those code in :

Code:
<?php
$PLAYER = simplexml_load_file('nowplaying.xml');
foreach ($PLAYER->TRACK as $TRACK) {  
  echo "<font color=\"#000099\">Artiste =</font> <font color=\"#000000\">{$TRACK['ARTIST']} </font>
\n";
  echo "<font color=\"#000099\">Titre =</font> <font color=\"#000000\">{$TRACK['TITLE']} </font>
\n";
  }
?>

I use a iframe to show that in my website

it's work perfectly

Thank you!
 
ok, i added "refresh feature" set to refresh the script each 10 sec.

first create a php file, call it "title.php"

insert that code inside
Code:
<?php
$PLAYER = simplexml_load_file('nowplaying.xml');
foreach ($PLAYER->TRACK as $TRACK) {  
  echo "<font color=\"#000099\">Artist =</font> <font color=\"#000000\">{$TRACK['ARTIST']} </font>
\n";
  echo "<font color=\"#000099\">Title =</font> <font color=\"#000000\">{$TRACK['TITLE']} </font>
\n";
  }
?>

upload it in your website in the same folder than your "nowplaying.xml" created and uploaded by RadioBoss

-------

after create a html file, call it "title.html"

insert that code inside

Code:
<html>
 <head>
  <title>refresh the title</title>
  <meta http-equiv="refresh" content="10">
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 </head>
 <body>
<iframe src="title.php" allowtransparency="true" height="80" width="200" frameborder=0 marginheight=0 marginwidth=0 scrolling=yes></iframe>
 </body>
</html>

upload it in your website in the same folder than your "nowplaying.xml" created and uploaded by RadioBoss

-------

after use that iframe script to show it anyware in your website,
Don't forget to change the adresse of that file inside that code!

Code:
<iframe src="http:your_website_adress_here/title.html" allowtransparency="true" height="100" width="300" frameborder=0 marginheight=0 marginwidth=0 scrolling=yes></iframe>

you can adjust the size of your box inside each script

Good luck!
 
Nice! It looks easier than our example script which uses AJAX to update information: http://www.djsoft.net/smf/index.php/topic,3176.0.html
 
Back
Top