PDA

View Full Version : Strange question about URLs :)


bober
04-16-2009, 08:09 AM
Well, the question is this: I have a tour located on some page of my site. While I am surfing through the tour, URL of the page remain same. So if I want to send link to certain panorama in the tour, I just can't do that.
I think a lot about it, but only solution Icould imagine is to make not a tour, but a pages with one pano on each and links that take you to anoyher page... A bit weird, I think :) Are there any other ways to do that?
And other question: I want to be able to begin tour from any pano depending on from what pade i do this. The simple way is to make several XML's with different "onStart", but it is weird too :) I use code like this:

<script type="text/javascript">
var so = new SWFObject("hotel.swf", "pano", "100%", "100%", "9", "#40373a");
so.addVariable("xml_file","hotel2.xml");
so.addVariable("filepath", getQueryParamValue("filepath"));
so.addParam("allowFullScreen","true");
so.addParam("allowScriptAccess","sameDomain");
so.write("flashcontent");
window.document["pano"].focus();
</script>

to include pano to page, maybe I can add something there to change "onStart" on the fly?

HansNyberg
04-16-2009, 08:35 AM
You can just duplicate your xml then change the initial pano and make a duplicate of your html with a new title and URL. Change the xml in this html

Here is an example.
Normal page http://www.panoramas.dk/kaloe-slot/index.html

Linked directly to pano 6 http://www.panoramas.dk/kaloe-slot/castle.html

Hans

bober
04-16-2009, 08:44 AM
You can just duplicate your xml then change the initial pano and make a duplicate of your html with a new title and URL. Change the xml in this html

Here is an example.
Normal page http://www.panoramas.dk/kaloe-slot/index.html

Linked directly to pano 6 http://www.panoramas.dk/kaloe-slot/castle.html

Hans

Maybe my English is not so good as I think, but upper I write that I already find this way :) If i can't find other ways, I'll use this, but as for me it looks like nail by a microscope :) An also, if after some time I'll want to change something in my tour I'll need to change all 30 XML's. Maybe you know how to do it using ExternalAPI ?

allSaints
04-16-2009, 08:46 AM
Hi Bober,

as you are using javascript to embed your FPP pano, you can also use javascript to parse a parameter that contains the name of the starting pano:

example URL: http://domain_name.com/path/nam.html?startpano=hotel3



...
<script type="text/javascript">
var startPano = getParm("startpano");

var so = new SWFObject("hotel.swf", "pano", "100%", "100%", "9", "#40373a");
so.addVariable("panoName",startPano);
so.addVariable("xml_file","hotel.xml");
so.addVariable("filepath", getQueryParamValue("filepath"));
so.addParam("allowFullScreen","true");
so.addParam("allowScriptAccess","sameDomain");
so.write("flashcontent");
window.document["pano"].focus();

function getParm( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}
</script>
...


So, by including the code above in your web page, you can choose your starting pano simply by changing the parameter in your url.

Regards,
Tommy

bober
04-16-2009, 09:07 AM
Hi Bober,

as you are using javascript to embed your FPP pano, you can also use javascript to parse a parameter that contains the name of the starting pano:

Regards,
Tommy

Thank you!!!!!!!!!
It works, and also it works as an answer to my first question, too !!!

Nate
04-16-2009, 06:05 PM
You could also use a query string in the url :
How to pass parameters to the player

Query string

Query string format is simple: player_name.swf?param1=value1&param2=value2&param3=value3

Use player name (swf name), then question-mark "?", then all needed parameters divided by ampersand "&"

For example: http://www.flashpanoramas.com/player/test/nature.swf?tiltHome=80&zoomHome=2. This gives a panorama from the simple tutorial with initial point of view in the sky (80 degrees above the horizon) with magnification (zoom factor is 2).

This gives you a possibility to run panoramas without any additional HTML or XML files.

It works as well for HTML code:

<PARAM NAME=movie VALUE="pano.swf?panoName=folder/mypano">

bober
04-17-2009, 07:02 PM
Hi Bober,

as you are using javascript to embed your FPP pano, you can also use javascript to parse a parameter that contains the name of the starting pano:

example URL: http://domain_name.com/path/nam.html?startpano=hotel3



...
<script type="text/javascript">
var startPano = getParm("startpano");

var so = new SWFObject("hotel.swf", "pano", "100%", "100%", "9", "#40373a");
so.addVariable("panoName",startPano);
so.addVariable("xml_file","hotel.xml");
so.addVariable("filepath", getQueryParamValue("filepath"));
so.addParam("allowFullScreen","true");
so.addParam("allowScriptAccess","sameDomain");
so.write("flashcontent");
window.document["pano"].focus();

function getParm( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}
</script>
...


So, by including the code above in your web page, you can choose your starting pano simply by changing the parameter in your url.

Regards,
Tommy

And one another question: what changes are needed to make tour open on some panorama (for example, 11/12_cube) when there are no parameters? Now in this case i see "loading failed"...

allSaints
04-17-2009, 09:32 PM
Well, bober

with a small change in the function getParm() you could set a default name if there are no parameters:

function getParm( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "default_pano_name";
else
return results[1];
}



Tommy

davide73
01-14-2011, 11:00 AM
Thanks Tommy for your code,
I used it to set not only the panoname but also pan, tilt and zoom of the first loaded pano.

Is there a way to pass other information to the player on startup, for example to execute a specific global.function related to the specific pano that is gonna be loaded?
I need for example to center the (great!) gpmap2 and sometimesto stop the autorotator directly from the link url.

What now works:
myDomain/index.html?startpano=mypano03&pan=90&tilt=17&zoom=3

What I need: something like
myDomain/index.html?startpano=mypano03&pan=90&tilt=17&zoom=3&autorotator=0&external.gpmap2.panto=myplace03&myText.htmlText=myDescription03
or (better)
myDomain/index.html?startpano=mypano03&pan=90&tilt=17&zoom=3&function=global.setup03

any idea?
thanksalot,
davide

p.s. I opened a thread here (http://flashpanoramas.com/forum/showthread.php?p=19103) before the idea of replying here: sorry for crossposting

sachagriffin
01-14-2011, 12:48 PM
Pass your queries to your xml, and use a programming language to accept your queries and output your custom xml. asp or php will work fine.

davide73
01-14-2011, 02:59 PM
That could be a solution, but I would have to create temp xml files for each user, it's a little tricky, it would be possible to trigger a custom fpp function on the first load, passing the function name encoded in the url.
I found a workaround that almost works, as I described it to you here (http://flashpanoramas.com/forum/showthread.php?p=19109#post19109)

thanks again

gr.panorama
04-12-2011, 03:12 PM
Hi Bober,

as you are using javascript to embed your FPP pano, you can also use javascript to parse a parameter that contains the name of the starting pano:

example URL: http://domain_name.com/path/nam.html?startpano=hotel3



...
<script type="text/javascript">
var startPano = getParm("startpano");

var so = new SWFObject("hotel.swf", "pano", "100%", "100%", "9", "#40373a");
so.addVariable("panoName",startPano);
so.addVariable("xml_file","hotel.xml");
so.addVariable("filepath", getQueryParamValue("filepath"));
so.addParam("allowFullScreen","true");
so.addParam("allowScriptAccess","sameDomain");
so.write("flashcontent");
window.document["pano"].focus();

function getParm( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}
</script>
...


So, by including the code above in your web page, you can choose your starting pano simply by changing the parameter in your url.

Regards,
Tommy

Hello Tommy,
I ve been trying this option but it keeps loading the default pano
a link :
http://hellaspanorama.gr/hosted/expoline/electronica/1.html?startpano=images/19

and the embed code:


<script type="text/javascript">
var startPano = getParm("startpano");

var so = new SWFObject("pano.swf", "pano", "100%", "100%", "9", "#40373a");
so.addVariable("panoName",startPano);
so.addVariable("xml_file","pano.xml");
so.addVariable("filepath", getQueryParamValue("filepath"));
so.addParam("allowFullScreen","true");
so.addParam("allowScriptAccess","sameDomain");
so.write("flashcontent");
window.document["pano"].focus();

function getParm( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "default_pano_name";
else
return results[1];
}
</script>

I tried renaming pano.swf and pano.xml, and replacing "filepath" with the panoramas directory without success.
Can't figure out where I' m wrong.
Any help would be much appreciated

Thanks,
Minnos

EnochTwig
04-14-2011, 07:20 PM
gr.panorama:

Unless I'm mistaken, getQueryParamValue("filepath") gets a parameter from the URL string, similarto getParm, so you need to have a value in the URL like:


http://hellaspanorama.gr/hosted/expoline/electronica/1.html?startpano=images/19&filepath=my/file/path


Although I've never seen any 'filepath' parameter for FPP so I'm not really sure what it's supposed to be doing.

gr.panorama
04-14-2011, 07:39 PM
Thanks for your reply,

http://hellaspanorama.gr/hosted/expoline/electronica/1.html?startpano=19&filepath=images
or
http://hellaspanorama.gr/hosted/expoline/electronica/1.html?startpano=images/19&filepath=images


does not seem to solve it

Minos

gr.panorama
04-15-2011, 11:45 PM
Anyone has used it successfully? A link to a working example would be really helpfull.

gr.panorama
08-17-2011, 12:31 PM
sorted out.....<parameters>panoname=images/00</parameters> and <global onStart="loadPano(panoName=images/00&amp;pan=80&amp;tilt=0&amp;zoom=0.6);"</global> had to be removed, having an initial or an onStart pano would not let starting panorama to be changed from url.