Trouble getting KRpano to create XML via PHP

  • Hello everyone!

    I having real trouble trying to get KRpano HTML5 viewer to work with dynamic XML from a MySQL database via PHP. I have a three-panorama tour, and the hotspots for each will be updated by the client in due course, so a dynamic system is required.

    However... I've scoured the forums and documentation and although several threads (see below) suggest this is indeed possible, I've now spent two days trying to get it to work and have so far failed miserably :(

    krpano HTML5 Viewer reading the database
    Get KRPANO to read from a DATABASE
    Integrate MySQL/PHP with Virtual Tour
    Database conection question...

    I have the tour.xml file, and here's a typical <scene></scene> tag:

    The hard-coded hotspots load in the pano, but the associated PHP-generated data does not appear when the hotspot is clicked. Hard-coding the <data> tags works, and I've checked the PHP code above outside of the framework and it produces the correct data. I've also tried embedding the PHP via a <?php <include url="data.php" /> ?> statement... nothing!

    I'm at a complete loss. Does anyone have any idea at what I may try to get this working? Apologies if this has been explained elsewhere - I've had a good look but can't find anything though! *confused*

  • Thanks for the quick response Piotr! The file is called tour.xml... but I've just created a duplicate of this called tour.php, and I've updated tour.html to call this file rather than tour.xml. It still doesn't work I'm afraid!

    Does anyone have the code for a working example they might be able to share with me? That way I could work through my code step by step and identify what might be wrong.

    Thanks for the help!

  • When you load the tour file into the browser directly, how does the generated XML look? Is the data actually echo'ed and if so, are all the brackets and things correct? It's easy to miss a special character in long composite strings. Often it is cleaner to use another combination method like concatenating.

    I also use php to generate KRpano tour files from a database and I have slowly but surely put everything is separate files that can be tested separately. Having the DB setup in just 1 file makes it a whole lot cleaner and easier to maintain.

    If you could link or post the resulting XML. Ow and if stuff is missing, check the source in the browser. errors and mistakes could be hidden between point brackets and stuff.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!