using one xml file for all panoramas, php pages

Q&A about the latest versions
Post Reply
russian box
Posts: 10
Joined: Sat Mar 10, 2012 6:08 pm

Hello, I am trying to make a site with lots of panoramas on, that works on PC with flash and iPad with html5.

To do this I am making a php file which displays a different panorama based on file.php?panorama=name

The name value checks a database for the panorama info. with flash this is easy.

I only need to change this:

Code: Select all

<script type="text/javascript">
<!--
			var flashvars = {};
			var params = {};
			params.quality = "high";
			params.bgcolor = "#ffffff";
			params.allowscriptaccess = "sameDomain";
			params.allowfullscreen = "true";
			params.base=".";
			var attributes = {};
			attributes.id = "pano";
			attributes.name = "pano";
			attributes.align = "middle";
			swfobject.embedSWF(
				"http://website.com/panorama/<?php print "$panoramaname"; ?>.swf", "flashContent", 
				"<?php print "$panoramawidth"; ?>", "<?php print "$panoramahight"; ?>", 
				"9.0.0", "expressInstall.swf", 
				flashvars, params, attributes);
//-->
		</script>
and link to the swfobject.js file.

but for html5 its not just in one file. you have an xml file to deal with.

can you change values in an xml file with php? or can I embed the xml data into the page (like you do with flash ^)
and change its values with php code, like I did above with flash

the xml file:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<panorama>
<view fovmode="0">
<start pan="42.5" tilt="-1.2" fov="58.5"/>
<min pan="-180" tilt="-30.5" fov="5"/>
<max pan="180" tilt="28" fov="120"/>
</view>
<input tilesize="1991" tilescale="1.00502" tile0url="images/by_knitting_o_0.jpg" tile1url="images/by_knitting_o_1.jpg" tile2url="images/by_knitting_o_2.jpg" tile3url="images/by_knitting_o_3.jpg" tile4url="images/by_knitting_o_4.jpg" tile5url="images/by_knitting_o_5.jpg" />
<userdata title="" description="" author="" datetime="" copyright="" source="" info="" comment="" />
<control sensitifity="8" simulatemass="1" lockedmouse="0" lockedkeyboard="0" lockedwheel="0" invertwheel="1" speedwheel="1" dblclickfullscreen="1" invertcontrol="1" />
<sounds>
</sounds>
</panorama>

If I can embed the xml in the php file, I'd need to change this:
pano.readConfigUrl("myxmlfile.xml");

to not point to an xml file but just look at the code. would that be the way to do it?

or i could just change the myxmlfile.xml to myxmlfile.php and change the values in itself as its not a php file.


why do we have the xml file? and not have it in the html?
Post Reply