开发者

conditional xml requests

开发者 https://www.devze.com 2023-04-11 19:14 出处:网络
I am trying to get my website to request a product from a mysql database, but I have a flash animation displaying the product. This animation is c开发者_Go百科ontroled by an xml file.

I am trying to get my website to request a product from a mysql database, but I have a flash animation displaying the product. This animation is c开发者_Go百科ontroled by an xml file.

Is there any way to incorporate a similar thing as a $_REQUEST in php in xml? Because otherwise i have to create 100+ xml for each product which will take time.

So some more technical details;

I have a product details page: www.yoursite.com/product/product.php

With a embedded flash:

<div style="width:300px; height:330px; padding:10px; margin:0px 585px 0px 10px;">
    <script type="text/javascript" src="swfobject.js"></script>
    <script type="text/javascript">
        var flashvars = {};
        var params = {};
        params.scale = "noscale";
        params.salign = "tl";
        params.wmode = "transparent";
        var attributes = {};
        swfobject.embedSWF("ImageBeforeandAfterFX.swf", "DivImageBeforeandAfterFX", "290", "320", "9.0.0", false, flashvars, params, attributes);
    </script>
    <div id="DivImageBeforeandAfterFX">
        <a href="http://www.adobe.com/go/getflashplayer">
            <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
        </a>
    </div>

And a image settings xml file (images.xml)

<photos>
<photo image="images/product_0001.png" colorboxImage="images/u4.png" colorboxInfo="" colorboxClass="image" url="http://web link" target="_blank"><![CDATA[<head>Reign Supreme</head><body>Drag line across to see the ball's core</body>]]></photo>
<photo image="images/product_c_0001.png" colorboxImage="images/u5.png" colorboxInfo="" colorboxClass="image" url="http://web link" target="_blank"><![CDATA[<head></head><body></body>]]></photo>
</photos>

What i want to do is for the 0001 (which is the id) to change depending on the product id which will be given in the server request. i.e.www.yoursite.com/product/product.php?id=0001 etc.


Since you are using PHP, you can generate XML dynamically in code, you don't need to create separate static files. Read the ID from the request, use it to query the DB, grab the values you need, and format a response string accordingly.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号