March 27, 2023, 07:41:57 PM
Welcome, Guest. Please login or register
News: Join us for a FREE Webinar this Thursday at http://webinar.digitalsignage.com

MediaSignage support forum



Author Topic: Trouble showing Xml Format, help vid not much help!  (Read 8046 times)

HVL

  • Full Member
  • ***
  • Posts: 86
  • Karma: +2/-0
Trouble showing Xml Format, help vid not much help!
« on: December 20, 2016, 06:58:36 AM »
Hello all

So have client who gets sports schedule in an XML file that im trying to show on their screen.

Been trying to follow the help vid. but the values shown differ from then ones i get.

"http://hornslet.halbooking.dk/feed/holdliste.asp?pid=01"   So when he does his 'burger.(@name=="ChickenBurger")' Im not sure how to set it up.

Can it be done with the code im getting or do I need to find other way ?


Also tried to do :

http://hvl-gruppen.dk/mediasignage/hornslet/ccms/xml1.html 

Where I converted it and put it on ftp and then thru the Html feature tried to show it.
But size is huge and cant figure out how to downscale it.
Prob some CSS script but not very good with that.

Now the best thing would probably be to get the first thing working since if the Xml file gets new info it will auto-update and it should take care of itself.
But if not possible I could live with the 2nd solution :)

Any help is much appreciated

/Per






admin

  • Administrator
  • Hero Member
  • *****
  • Posts: 5166
  • Karma: +36/-8
Re: Trouble showing Xml Format, help vid not much help!
« Reply #1 on: December 21, 2016, 12:12:04 PM »
Please connect with Live support: http://chat.digitalsignage.com so we can troubleshoot your concern.  Please look for either Sherwin or Ron P.

HVL

  • Full Member
  • ***
  • Posts: 86
  • Karma: +2/-0
Re: Trouble showing Xml Format, help vid not much help!
« Reply #2 on: January 06, 2017, 06:00:53 AM »
Had a nice talk with RonP.

was hoping for the possibility to make a Xml Scene that would autoupdate in teamviewer, if the xml data from source changes.
Seems that is not possible so have to devise my own php script !  That will load the info, reformat and send back thru html5.

Work in progress since I am clueless about php.

If i get it to work this weekend. (off the clock) I will post and update for future use. !


HVL

  • Full Member
  • ***
  • Posts: 86
  • Karma: +2/-0
Re: Trouble showing Xml Format, help vid not much help!
« Reply #3 on: January 24, 2017, 12:17:20 AM »
So ended up fixing the problem myself with a lot of hours on google and figuring out how to make a php script.

Code: [Select]
<?php



//Get XML from website


$xmlfromhb file_get_contents("http://"XMLlink");  saving the xml file for further use.

// Parse XML
$xml = simplexml_load_string($xmlfromhb) or die("ErrorCannot create object");  //T

//print_r(
$xml);


// Print HTML header
?>

<!DOCTYPE html>
<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
         <title>Fetch XML and output modified HTML</title>
         <style>
         table {
         border-collapse: collapse;
         }
         table, th, td {
         border: 1px solid black;
         }
         </style>
      </head>
      <body style="max-width: 716px; max-height: 756px; overflow:hidden; border: 1px solid black;">
      <div max-width=100%;>
         <table>
            <thead>                                                                      //Setting up the html layout, with the Table headers I want to show. (many but only needed 5)
               <tr>
                  <th>Start</th>
                  <th>Slut</th>
                  <th>Titel</th>
                  <th>Instrukt&oslash;r</th>
                  <th>Sted</th>
               </tr>
            </thead>
            <tbody>
<?php


// Run thru XML and pull out the info needed for print in the html 
foreach($xml->hold as $hold) {
   print 
"<tr>\n";
   print 
"<td>" str_replace('T',' ',$hold->start) . "</td>";    //The data had a "T" in the middle of it. With this command I was able to replace the "T" with " ". and solve the problem :)
   
print "\n";
   print 
"<td>" str_replace('T',' ',$hold->slut) . "</td>";
   print 
"\n";
   print 
"<td>" $hold->titel "</td>";
   print 
"\n";
   print 
"<td>" $hold->instr "</td>";
   print 
"\n";
   print 
"<td>" $hold->sted "</td>";
   print 
"\n";
   
   print 
"</tr>\n";
}

?>

            </tbody>
         </table>
         <>
      </body>
   </html>




Hope it can help others as this was quite the problem on my end.


Any suggestions on improvement are greatly appreciated also .


/HVL

 

Carbonate design by Bloc
variant: carbon
SMF 2.0.12 | SMF © 2016, Simple Machines