Sie sind nicht angemeldet.

JPG_master

Anfänger

  • »JPG_master« ist der Autor dieses Themas

Beiträge: 20

Wohnort: Deutschland

Beruf: IT Manager

  • Nachricht senden

1

Donnerstag, 30. April 2015, 08:36

Passing Variable from HTML to %$VARIABLE% placeholder in XML via JavaScript

Hi All,
hi Klaus,

I pass variables to my XML from the HTML in many cases successfully.

Example is

Zitat

viewer= createPanoViewer({swf:"ANYPANO.swf", xml:"ANYPANO.xml", target:"pano", id:"krpanoSWFObject", html5:"auto", passQueryParameters:true, wmode:"opaque"});
viewer.addVariable("root", window.location.href);
...
The variable <root> can be adressed with this name within XML.

Using this to follow the documentation given in:

Zitat

http://krpano.com/docu/xml/#url-notes

...
%$VARIABLE% - Use the value of the given 'VARIABLE' - this can be
any krpano variable,
but it must be defined before the current xml or scene will be
loaded, e.g. already in the html file or before loadpano(), loadscene()
calls.
in order to have a flexible INCLUDE STATEMENT like (using a placeholdername in my below example <myvariable_from_html_via_JS_here>

Zitat

<include url="%BASEDIR%/plugins/ %$myvariable_from_html_via_JS_here% / MyPanoDetailDefs.xml" />

I get the XML load error showing the %$...% content unparsed.
It looks, as if krpano does not parse the viewer.addvariable content into the %$...% construction.

Any Ideas?

Target:
use all the same xml files but INCLUDE different PARAMETER xml-files for Panos flexible called from outside via html:

Zitat

www.<site>.<dom>/<file>.html#parameter1=<value1>?parameter2=<value2>
BTW - the parsing and passing works fine with variable used and read with <action>s but nit with in the URL ATTRIBUTE.

Thanks guys
*smile*
Honi soit qui mal y pense ! *thumbup*

2

Freitag, 8. Mai 2015, 13:28

Hi,

such variables would need to be passed via 'initvars':
http://krpano.com/docu/html/#initvars

With the new 1.19 pre-release 2 these can be passed also as query parameters by adding the prefix 'initvars.' to the variable name.

Best regards,
Klaus