Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
I wanted to put a flash slideshow embeded on my website. The links and descriptions of the pictures get loaded from an xml file. For ease of use purposes, I was trying to find a way for couch to manage that xml file. I came up with some crazy ideas but I have not tested them yet. I do not know exactly how the flash file opens the xml file. like if it goes through the website, then i could possibly change the extension to php and use it to output the content in xml format, assuming it would work. My next idea was:
user visits site:
the flash content is included from another page
I have that page managed by couch. Before it loads the flash content, at the top it would be like this:

opening tag for couch:
open the xml file for writing:
getting the variables from couch and out in correct xml format:
overwrite the xml file with the new content:
close the file:
**flash content that loads the newly saved xml file**

I thought that would be a great idea, but the issue is if i get a large number of users at once, then that is alot of server intensive code.
So is there a way that I could have couch manage an xml page? even if it requires some serious craziness.

I also do not mind tempting to code my own php page that can read and edit an xml page, but id prefer not to. If this isn't already a function in couch then I think it would be a very nice thing to add.
Hopefully this makes sense. I got 2 hours of sleep last night so i dont know how much im actually thinking
Hi hey101,

Welcome to our forums.

Basically what you want is a Couch managed PHP file that outputs XML (which in this case serves as the input for the Flash applet).

You'll can find a discussion of this at where we output XML RSS feed using couch but I'll repeat the salient points -

Let us assume the name of our PHP file is photoslist.php.
Immediately after the opening Couch statement, place the 'content_type' tag and output the 'xml' opening tag. It shoud look like the following -
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:content_type 'text/xml' /><cms:concat '<' '?xml version="1.0" encoding="' k_site_charset '"?' '>' />

This sets the mime-type of the page and now your PHP can output all the XML it needs.

However since the Couch managed file has to have a '.php' extension, this might not be acceptable to the flash applet if it is hard-coded to accept only a '.xml' file.
To resolve this, you can place the following line in your .htaccess file -
Code: Select all
RewriteRule ^photoslist\.xml$ photoslist.php  [L]

Place your static XML into this file and it should work.
However, of course, we need to dynamically produce the XML.
This can be done using the standard 'pages' tag.
Assuming that you have a clonable template named 'photos.php' that has an editable region of 'image' type named 'my_photo', the following snippet placed within our XML producing php -
Code: Select all
    <cms:pages masterpage='photos.php'>
            <image><cms:show my_photo /></image>
            <caption><cms:show k_page_title /></caption>

- will output photos contained within each cloned page.
The <images>, <pic> and <caption> tags are made-up for illustration. You can substitute them with whatever XML tags that are required by the flash applet.
Of course, you can use all the available parameters of 'pages' tag to filter the images that are listed.

Hope this helps.
I just tried it and it works. Thank you so much
3 posts Page 1 of 1

Who is online

In total there are 5 users online :: 0 registered, 0 hidden and 5 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 5 guests