You are not logged in.

1

Monday, May 13th 2013, 10:01am

[resolved] The list of variables and their values

Hello

Sorry for broken English. This post is written with the help of Google-Translator.

My task:
Divide the control code, and all texts (titles hotspots, the names of panoramas, etc.)

Examples:

Source code

1
2
3
4
5
<hotspot name="hs_01"   devices="all"
	onhover="showtext(TEXT, hs_name_style);"
   />
...
<scene name="scene_01" title="NAME" thumburl="%SWFPATH%/panos/01.tiles/thumb.jpg" >

I want to put text into a separate file.

Source code

1
2
3
4
5
6
7
8
<include url="%SWFPATH%/skin/text_data_ru.xml" />
(or <include url="%SWFPATH%/skin/text_data_en.xml" />, etc...)
...
<hotspot name="hs_01"   devices="all"
   onhover="showtext($Hs_text_01, hs_name_style);"
   />
...
<scene name="scene_01" title="$Pano_name_01" thumburl="%SWFPATH%/panos/01.tiles/thumb.jpg" >


text_data_ru.xml

Source code

1
2
3
4
5
6
$Hs_text_01="TEXT-1"
$Hs_text_02="TEXT-2"
...
$Pano_name_01="NAME-01"
$Pano_name_01="NAME-02"
...


This is in order that would simplify the work on translations, typos, etc.
A separate file that contains in one place all the used texts - it's very convenient.

How to do it?

PS
I read these threads. But there is described a different functionality. I need the imposition of a separate text file.
http://www.krpano.com/forum/wbb/index.ph…d&threadID=9144
Switching showtext according to chosen language?

This post has been edited 1 times, last edit by "localhostroot" (May 26th 2013, 6:54pm)


2

Saturday, May 25th 2013, 7:34pm

XML is a markup language and there's no clear definition of "variable".
How can I create a separate file containing only texts? I'm pretty sure there's a way to do it.


Working with hundreds and thousands lines disseminated across the files with scenes is kinda disaster.

3

Saturday, May 25th 2013, 8:04pm

if you are holding your data in text files or in database etc, in my opinion:

1- You can create a script to create xml dynamically up to your data, there are various ways to create xml strings and adding elements into them.
2- You can get your data and programmatically create panorama/hotspots/buttons or add panoramic pictures etc. I don't know action script much but even in javascript you can do it easily. I saw in some topics, people suggest action script because of performance benefits. Which way you feel comfortable you can choose.

To be honest krpano's api documentation is really good one and you can find whatever you want to do in it.

Edit: For example, let's say you have millions of hotspots and thousands of pictures. You don't have to set xml file for every picture, you just can get these data dynamically from your source (or write there dynamically) use them whenever you need and add them to panoramic views in programmatic way.

addHotspot(+variableNameHere+);
hotspot[+variableNameHere+].point[0].ath = variableAthHere..... etc. Code syntax might have flaws but in this way you will only write one function or so to save or load your panoroma data.

Edit2: in short you are not limited with xml files, you can also use krpano in programmatic way. Check this out: http://krpano.com/docu/quickref/#top http://krpano.com/docu/actions/#top

This post has been edited 1 times, last edit by "electronicpanda" (May 25th 2013, 8:14pm)


Umalo

Professional

Posts: 1,047

Location: Osijek, Croatia, EU

  • Send private message

4

Saturday, May 25th 2013, 11:39pm

Read again:
http://www.krpano.com/forum/wbb/index.ph…45820#post45820

and in your case this part of definition

Source code

1
2
3
4
5
6
7
8
9
<language name="german">	<text name="spot0" value="Hallo" />
	<text name="spot1" value="Du" />
	...
</language>

<language name="english">
	<text name="spot0" value="Hello" />
	<text name="spot1" value="You" />
	... </language>

store in separate xml file that you include as you wrote.
This is the way I also use.

5

Sunday, May 26th 2013, 4:03pm

There was a raving lunatic.

This post has been edited 1 times, last edit by "localhostroot" (May 26th 2013, 6:42pm)


6

Sunday, May 26th 2013, 5:09pm

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
<language name="russian">

<text name="scene_01" 	value1=""	value2=""	/>
<text name="scene_02" 	value1=""	value2=""	/>
	
</language>

<language name="english">

<text name="scene_01" 	value1=""	value2=""	/>
<text name="scene_02" 	value1=""	value2=""	/>
	
</language>


Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<action name="skin_update_scene_infos">
if(xml.scene != null,
	
if(title, 	txtadd(layer[skin_title].html, get(title), '[br]', get(language[get(currentlanguage)].text[get(xml.scene)].value1) ); , 
copy(layer[skin_title].html, language[get(currentlanguage)].text[get(xml.scene)].value1 ); 
);
	
delayedcall(0.1, set(layer[skin_title].visible,true) );

if(title2, 	txtadd(layer[skin_scene_name].html, get(language[get(currentlanguage)].text[get(xml.scene)].value2) ); , 
copy(layer[skin_scene_name].html, language[get(currentlanguage)].text[get(xml.scene)].value2 ); 
);

delayedcall(0.1, set(layer[skin_scene_name].visible,true) );

</action>


Understood. Everything is working.
Thank you all for the tips.

This post has been edited 1 times, last edit by "localhostroot" (May 26th 2013, 6:41pm)


Umalo

Professional

Posts: 1,047

Location: Osijek, Croatia, EU

  • Send private message

7

Sunday, May 26th 2013, 9:08pm

don't see how you are handling title and title2, but if you say you got the point and your solution is working we are happy.