Page 1 of 1

custom parameters by external url

Posted: Tue Apr 30, 2019 1:19 pm
by daBernd
Hi there,
is it possible to get custom values "inside"? Not only like a DNA url.
I think of passing additional information like a value or a hotspot-ID or a string, which then can be used in the skin as a variable.

ex: ... mywebsite.com/NameOfPano/index.html#node1,-25,0.0,70,CustomValue

My intention to this, is that I want to pass the ID of a hotspot, which then will be shown in a different color, or size or even blinking.

Re: custom parameters by external url

Posted: Tue Apr 30, 2019 4:50 pm
by thomas
You can do this with some lines of JavaScript.
Just look at the code for direct node access in the index.html. There you can add a field that is written to a variable with a setVariable action.

Re: custom parameters by external url

Posted: Wed May 01, 2019 6:27 pm
by daBernd
thank you,
passing the value now works fine. I can display the value in a textfield. But now I have no idea how to compare the string-value inside a logic block.
I created a different Icon for the ht_info which should be visible if the poiID variable has got the same value as the title of the Hotspot. But comparing a variable with a variable or a placeholder does not work inside the logic block.
How can i do this?

Is this the wrong way?

Image

Image

Re: custom parameters by external url

Posted: Thu May 02, 2019 1:25 pm
by daBernd
I now made a workaround:

Image

and in the skin.js I replaced all occurences of the string "$me.hotspot.url" - Take care of the quotation marks - they are part of the String which needs to be replaced. The string for the replacement: me.hotspot.url .

Image

This works because now the Variable poiID is correctly compared to the concerned Hotspot-URL, and not just with a hardcoded string.

But there must be a more elegant way to do this...

Re: custom parameters by external url

Posted: Fri May 03, 2019 3:20 pm
by thomas
At the moment placeholders cannot be used in logic blocks as values, but this is on the todo list for a future version.

Re: custom parameters by external url

Posted: Wed May 08, 2019 1:29 pm
by paulk
Hello

Have been reading this thread with interest.

Thomas - Is it possible to give an example of the javascript addition you mentioned?

If I understand your comment correctly one could create a url link not only with the node id but I could add a variable value that could be written to a variable that has been created in the skin?

Therefore say a skin variable named 'myvariable' holds numbers and is defaulted to the value 0 - could this variable be passed a value in the url string?

So something like: "myurl.html#mynode,1" would open the node "mynode" and assign the value 1 to myvariable.
if this is possible it would be very useful.

I would be very grateful if you could show what was required to achieve this.

Many thanks

Re: custom parameters by external url

Posted: Fri May 10, 2019 3:07 pm
by paulk
Hello
Anyone have any views on this?

Re: custom parameters by external url

Posted: Mon May 13, 2019 8:28 pm
by daBernd
@PaulK

Hi there,
first you need to add a variable in skin-editor with the setvariable action. Let'name it myExtValue. Let it be a string which is assigned to a textfield for better testing.
Then you need to edit your .ggt file (HTML)
In there you need extend the parseParams - function. In standard there are up to 4 parameters which will be parsed. Therefore your custom value hast to be the fifth:

// get additional Parameter from URL
if (viewingParams.length >= 5) {
params.myCustomValue = viewingParams[4];
}

And your URL has to look like: ... myTours.com/tour01/index.html#nodeID,pan,tilt,fov,projection,customValue

in the .ggt - file, after the line: parseParams(document.location.hash, params); you can assign your parsed value to your skin variable:
pano.setVariableValue('myExtValue',params.myCustomValue);

BUT! ... be carefull editing your .ggt-File. First save a copy of the original.

If you do not know what you're doing, leave it to someone who knows. I'm not taking any responsibility.

Re: custom parameters by external url

Posted: Tue May 14, 2019 6:37 pm
by paulk
Hi DaBernd

Thank you for your reply. Lots to think about there. Will have a play with your suggestion and post my findings.

Think this would be a great feature to add btw.

Many thanks