You are not logged in.

panoErik

Beginner

  • "panoErik" started this thread

Posts: 26

Location: Annecy, France

  • Send private message

1

Monday, January 23rd 2012, 6:43pm

Multiple xml files

Hello everybody!

I remember that I have read that some people use multiple .xml files, one for each device. I like to do that. At least one for desktop and one for iphone/ipad.

I have been searching the forum but can not find a relevant message.

Can somebody please help me with how to write the code to point different devices to different xml files at startup.

Tanks guys *smile*

/ erik

Posts: 1,857

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

panoErik

Beginner

  • "panoErik" started this thread

Posts: 26

Location: Annecy, France

  • Send private message

3

Tuesday, January 24th 2012, 3:53pm

Hello

Thanks for your answer. I am familiar with the "include" and "devices" attributes, I just have not combined these two before. ( I have only used the devices attribute with plugins or hotspots ) So, excuse me if I ask a stupid question. How do I give the include xml the device attribute. This is what I tried to ask from start :)

I this ok?

<include url="path/name-of-the-other-xml-file.xml" devices="mobile|tablet"/>



Thanks / erik </include> *smile*

Tuur

Sage

Posts: 3,839

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

4

Tuesday, January 24th 2012, 3:57pm

check my website and then, for example, the first example left top and then check the code of the index..

et voila

Tuur *thumbsup*

ok.. here is the code:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<body>

<script src="XXX.js"></script>
<div id="pano" style="width:100%; height:100%; background-color:#FFF;">
	<noscript><table style="width:100%;height:100%;"><tr style="valign:middle;"><td><div style="text-align:center;">ERROR:<br/><br/>Javascript not activated<br/><br/></div></td></tr></table></noscript>



<script>

	var viewer = createPanoViewer({swf:"XXX.swf", id:"krpanoSWFObject", target:"pano"});
	//viewer.useHTML5("whenpossible");		// incomment to use the HTML5 krpanoJS viewer always when possible (Safari5)

	if( viewer.isDevice("iPhone|iPod|Android") )
		viewer.addVariable("xml", "mobile/phone.xml");
		
	else if( viewer.isDevice("iPad|tablet") )
  		viewer.addVariable("xml", "mobile/pad.xml");	
		
		
		
	else
		viewer.addVariable("xml", "local/tour.xml");

	viewer.embed();

</script></div>

</body>

panoErik

Beginner

  • "panoErik" started this thread

Posts: 26

Location: Annecy, France

  • Send private message

5

Tuesday, January 24th 2012, 4:38pm

Thanks a lot Tuur!!! ;-) I will try that.

Would it work if the first xml file that is loaded from the html file (like pano.xml) looked something like this??? Is it possible to put a devices command like this in the include command?


<krpano version="1.0.8.14">

<include url="%SWFPATH%/tourdata/phone.xml" devices="mobile" />

<include url="%SWFPATH%/tourdata/desktop.xml" devices="desktop" />

</krpano>

Posts: 1,857

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

6

Tuesday, January 24th 2012, 5:06pm

Just try it. There's no harm in that.
Recent krpano versions state that the devices attribute works in ALL xml tags. So you're good to go.
Use the simulated device variable to see your changes in action.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

panoErik

Beginner

  • "panoErik" started this thread

Posts: 26

Location: Annecy, France

  • Send private message

7

Tuesday, January 24th 2012, 5:24pm

Hello sachagriffin

You are right. I should have done like I always have done. Try by myself *smile* I did try now and it seems to work. I guess I just wanted to verify that this way would be a good way to do it. I don't like to find out much later, after putting in a lot of work creating the pano, that this way is not so stable or does not work in certain situations ...

I think I will try it. Thanks to you all who are so kind to help out with all the questions from non programmers like me!!! *thumbsup*

Tanks / erik