Sie sind nicht angemeldet.

1

Montag, 29. November 2010, 05:25

Pass variable from HTML to XML

Hi,
I'm attempting to pass a variable from html to xml, but I'm not having much success. I call the html with a query string containing my variable like this:

Quellcode

1
http://website.com/index.html?viewmode=external


index.html contains this code for setting up the pano:

Quellcode

1
2
3
4
5
6
<script type="text/javascript">
   var swf = createswf("krpano.swf");
   swf.addVariable("xml","pano.xml");
   swf.passQueryParameters();
   swf.embed("pano");
</script>


pano.xml contains code in an action to trace the value of the variable when a hotspot is clicked:

Quellcode

1
2
3
4
<action name="tracelog">
   trace('viewmode=',viewmode);
   showlog();
</action>


The log just shows "viewmode=viewmode". I'm not using kprotect. Any ideas?

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Andrew« (29. November 2010, 05:49)


2

Montag, 29. November 2010, 08:11

I should add, I just need some way of passing a variable externally to the pano XML. Perhaps there is an alternative you can think of?

cheers,
Andrew

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

3

Montag, 29. November 2010, 08:33

try: trace('viewmode=',get(viewmode));

4

Dienstag, 30. November 2010, 00:54

Thanks Zephyr. That returns null.

5

Dienstag, 30. November 2010, 11:30

http://www.krpano.com/forum/wbb/index.ph…d&threadID=3500 . That might help. That thread is about passing the parameters from the url to the xml file with javascript.

jpdeglet69

Fortgeschrittener

Beiträge: 215

Wohnort: France

Beruf: VR Maker and Document Management Expert

  • Nachricht senden

6

Dienstag, 30. November 2010, 11:40

Hi,

Based on KrPano "js-getlink", Have a look on

KrPano Post "Direct access from email"
Best regards,
JPhD
VR-Guide®/Eleana CEO
https://eleana.online

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »jpdeglet69« (30. November 2010, 17:57)


7

Dienstag, 30. November 2010, 14:42

I was lucky with this solution until the latest krpano version:

Quellcode

1
2
3
4
5
6
7
8
<script type="text/javascript">

	var swf = createswf("krpano.swf");
	swf.addVariable("xml","srebrenica_pillar-of-shame1_berlin-2010_4000h.xml");
	swf.addVariable("startPano", "start");
	swf.embed("krpanoDIV");

</script>


With the new Krpano, the HTML looks a bit different, and it seems that this does not work (startPano is now NULL). Any solution for this as well?

Quellcode

1
2
3
<script>
		embedpano({swf:"hauptdeck_buffetlift_2.swf", xml:"hauptdeck_buffetlift_2.xml", target:"pano", startPano:"start"});
	</script>

8

Mittwoch, 1. Dezember 2010, 13:46

Hi,
The log just shows "viewmode=viewmode". I'm not using kprotect. Any ideas?
the code is correct and should work, the swf.passQueryParameters();

call should pass all given parameters to variables...
do you have a link to the not working example?

With the new Krpano, the HTML looks a bit different, and it seems that this does not work (startPano is now NULL). Any solution for this as well?
you can still use the old createswf() function,
the embedpano() is just an additional simplified single-line function when not parameters or further settings are needed, custom parameters can't be used with it,

see here for more details about the functions and their usage:
http://krpano.com/docu/swfkrpanojs/#syntax
http://krpano.com/docu/swfkrpanojs/#description

best regards,
Klaus

9

Mittwoch, 1. Dezember 2010, 15:30

Ah, thank you very much! I'll try!
you can still use the old createswf() function,
the embedpano() is just an additional simplified single-line function when not parameters or further settings are needed, custom parameters can't be used with it,

see here for more details about the functions and their usage:
http://krpano.com/docu/swfkrpanojs/#syntax
http://krpano.com/docu/swfkrpanojs/#description

best regards,
Klaus
edit: I succeeded using this code now, thank you for pointing me to the right function:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<body>

	<script src="panoramaname.js">
	</script>

<div id="pano" style="width:100%; height:100%;">
	<noscript>
...
	</noscript>

<script>
  var viewer = createPanoViewer({swf:"panoramaname.swf",target:"pano"});
  viewer.addVariable("xml", "panoramaname.xml");
  viewer.addVariable("my_own_variable_name", "my_own_variable_value");
  viewer.embed();
</script>

</div>

</body>

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »mstoss« (6. Dezember 2010, 09:39)