Sie sind nicht angemeldet.

hfeist

Anfänger

  • »hfeist« ist der Autor dieses Themas

Beiträge: 9

Wohnort: Toronto

Beruf: artist

  • Nachricht senden

1

Freitag, 31. Juli 2015, 00:12

how to plugin/layer/map urls depending on variable?

I've been flailing around for days now trying to figure out how to use a language cookie to change maps/plugins/layers dynamically. I've got plugins and lays coming along pretty well but have just bumped up against the map. It seems layers called "map" do not like their name changed to something like "frenchMap" and "englishMap" so I can turn whichever one I want on with set(layer[frenchMap].visible,true). It swaps ok but doesn't seem to function as a map unless it is called "map." Clicks don't open new panoramas as expected.
So now I'm wondering if there might be a way to dynamically change the layer url somehow. Setting a variable like "mapImage" to say "frenchMap.png" and then trying <layer name="map" url=mapImage doesn't work.
I seem to be barking up the wrong tree!

hfeist

Anfänger

  • »hfeist« ist der Autor dieses Themas

Beiträge: 9

Wohnort: Toronto

Beruf: artist

  • Nachricht senden

2

Freitag, 31. Juli 2015, 16:34

For the moment I've opted to use the inelegant method of simply loading a different tour.xml file depending on the language cookie. It means having to update each file when changes are needed but causes perhaps the fewest headaches.

3

Dienstag, 4. August 2015, 17:25

Hi,

you could use the new 'calc' feature and the 'tenary operator' of the 1.19 pre-release version:
http://krpano.com/docu/actions/#calc
http://krpano.com/docu/actions/#expressions

e.g.

Quellcode

1
url="calc:language == 'fr' ? 'frenchMap.png' : 'englishMap.png'"


Best regards,
Klaus