Dynamik content over Hotspot

  • Hi
    I am sitting on a problem and can't find a way... Maybe somebody knows a little help.
    I would like to have hotspots with showing dynamic content :
    For example, let's say
    I have some houses in my pano. On every house there is a Hotspot which shows the name of the owner.

    In a sql-database I have saved all the names.
    The xml-hotspots are made by php with the names from the database as a xml-variable.

    Echo '<Hotspot name =" hotspot"..... Owner="Mr smith" />' ;

    When touching the hotshot I need the content of the variable "owner" to get the right content from the database. Thus I need to catch it by php in any way. But I don't know how to achieve this.
    For easier understanding, I want to have an php output of the content of the xml-variable, something like
    Echo get[owner] ;

    Thanks in advance!

    Edited once, last by Muxi (April 2, 2015 at 2:31 AM).

  • I noticed that the only problem is that I can't use a self determined variable like "owner", so I will try it with using the" name " variable

  • You have to use mix of javascript/AJAX/php. But in the case of small darabase (eg. 100-200 records) better way is generating xml dynamically and storing all data in <data ...> object or any other xml structure eg.

    Code
    <records>
    	<record name="r1" value1="..." />
    	<record name="r2" value1="..." />
    	<record name="r3" value1="..." />
    </records>

    That gives you an instant access to data without using javascript/AJAX

  • Ok, thanks, that would be an alternative.
    But I achieved it already with the js function. And as I want to work for longer time with these data it would be much more comfortable to edit them by php/mysql.
    As I mentioned before, by using js within a Hotspot style, I could get access to the variable "name". But - as I am not really through this xml stuff - it did not work with a self determined variable like" owner" which I defined within the Hotspot tag. If I cannot define variables by myself, are there any other given variables which I can use in the Hotspot tag? Or is there a way to define new variables to use?

  • You can pass any variable to js function. Eg. if you have hotspot like this, you can pass name, ath, atv or any other attribute. Try the following examples:

    Code
    <hotspot name="hs1" ath="0" atv="0" owner="John Doe" ... onclick="js(alert(get(name)))"/>
    <hotspot name="hs2" ath="90" atv="0" owner="John Doe" ... onclick="js(alert(get(owner)))"/>

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!