Sie sind nicht angemeldet.

1

Mittwoch, 1. April 2015, 22:18

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!

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Muxi« (2. April 2015, 02:31)


2

Donnerstag, 2. April 2015, 09:30

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

panomaster

Fortgeschrittener

Beiträge: 297

Wohnort: Kobyłka, Poland

Beruf: Virtual Tours - Spherical Panoramas - Krpano developer

  • Nachricht senden

3

Donnerstag, 2. April 2015, 13:27

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.

Quellcode

1
2
3
4
5
<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

4

Donnerstag, 2. April 2015, 17:43

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?

panomaster

Fortgeschrittener

Beiträge: 297

Wohnort: Kobyłka, Poland

Beruf: Virtual Tours - Spherical Panoramas - Krpano developer

  • Nachricht senden

5

Freitag, 3. April 2015, 08:18

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:

Quellcode

1
2
<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)))"/>