You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

hfeist

Beginner

  • "hfeist" started this thread

Posts: 9

Location: Toronto

Occupation: artist

  • Send private message

1

Friday, July 31st 2015, 12:12am

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

Beginner

  • "hfeist" started this thread

Posts: 9

Location: Toronto

Occupation: artist

  • Send private message

2

Friday, July 31st 2015, 4:34pm

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

Tuesday, August 4th 2015, 5:25pm

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.

Source code

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


Best regards,
Klaus