View Single Post
  #12  
Old 04-12-2011, 04:12 PM
gr.panorama gr.panorama is offline
Member
 
Join Date: Jul 2010
Location: Greece
Posts: 33
Downloads: 1
Uploads: 0
Default parse a parameter that contains the name of the starting pano

Quote:
Originally Posted by allSaints View Post
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


Code:
...
<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/expo...pano=images/19

and the embed code:

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
Reply With Quote