You are not logged in.

1

Wednesday, April 1st 2015, 10:18pm

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!

This post has been edited 1 times, last edit by "Muxi" (Apr 2nd 2015, 2:31am)


2

Thursday, April 2nd 2015, 9:30am

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

Intermediate

Posts: 297

Location: Kobyłka, Poland

Occupation: Virtual Tours - Spherical Panoramas - Krpano developer

  • Send private message

3

Thursday, April 2nd 2015, 1:27pm

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.

Source code

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

Thursday, April 2nd 2015, 5:43pm

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

Intermediate

Posts: 297

Location: Kobyłka, Poland

Occupation: Virtual Tours - Spherical Panoramas - Krpano developer

  • Send private message

5

Friday, April 3rd 2015, 8:18am

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:

Source code

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