Krpano using outside variables

You can define variables from outside krpano in your html and then send it to krpano. This has some advantages, you can for instance define a language or version and then send it to krpano.

var viewer = createPanoViewer({swf:"krpano.swf", xml:"tour.xml", target:"pano"});
viewer.addVariable("language", 'uk');
viewer.addVariable("version", '0.1');

In krpano you can get the variable by simply using get(language) and get(version).

There is one exception. If you wish to use it in a url sequence, you have to use the following format: %&VARIABLE%


<include url="file.xml?v=%$version%" />

The last example is a good way to prevent flash caching. When you update your krpano tour. Just change the version number in your html (or use php, and read the modified date). All the xml’s you include or plugin/hotspots urls will append this version number and is thus considered as a new file and downloaded again by the browser. This is a much cleaner way then my previous flash cachebusting solution.

Leave a Reply

Your email address will not be published. Required fields are marked *