Forum for discussing general topics related to Couch.
8 posts Page 1 of 1
I've used the RSS feed technique where couch (in a PHP file) gathers data from a page and builds an "XML" RSS feed, I modified it
to store a list of video clips in the XML layout.

the point is to direct my html5 video player
to this xml file to pick out different properties
such as file name, file location, file type... But
it doesn't seem to work as it would with an
actual xml file. (I'm using PHP simplexml)
I assumed the video player isn't seeing
parsed XML content but instead raw cms code as it could be accessing the playlist directly as if opening it in notepad, as opposed to a browser where the code would be executed and delivered as flat HTML.

Is
there a way to have this template (playlist.php)
dynamically export itself as an ".xml" ??
(Overwriting itself every time)
---
You live many times, but only ever remember your lives.length - 1
---
Image
Can you get it working without Couch?
If yes, that would be the baseline to work on.
Keep a copy of the original working XML file
and compare it with the couchified version.
The two should be identical.


The SimpleXML code I am using is not returning any values from the playlist.
Browsing the playlist.php file reveals an XML parsing error, just as it does with feed.php, stating that the XML or text declaration is not at the start of the entity.

--- EDIT ---
Between the <?php require_once code and the <cms:template AND the beginning of the content mime type, there was new paragraphs, I deleted them to create NO space between each tag, and now the "XML" files are readable in the browser, however the PHP SimpleXML code I'm using still isn't working,
its inbetween <cms:php> tags but yet its taking the page offline when I access its URL.

Code: Select all
<cms:php>
$xml = simplexml load_file('playlist.php');
echo $xml->getName() . "<br />";
</cms:php>


By viewing the playlist.php's source code from the browser, then saving that source code as playlist.xml has helped, I can see the XML content, narrowing down the issue to either the simplexml code, or Couch.
---
You live many times, but only ever remember your lives.length - 1
---
Image
Let us keep aside generating XML dynamically via Couch for a little while please.

My question was - can you get the video player work with any static XML on your server?
If so what is the code? Can you get it to work like this (where we are using a static XML file)?

<cms:php>
$xml = simplexml load_file('playlist.xml');
echo $xml->getName() . "<br />";
</cms:php>

Please let me know.
KK wrote: My question was - can you get the video player work with any static XML on your server?
If so what is the code? Can you get it to work like this (where we are using a static XML file)?


Sorry KK I didn't think you'd be here so quick, I updated my last comment.
I am now able to view the XML file via simpleXML code.
---
You live many times, but only ever remember your lives.length - 1
---
Image
Not sure if I still get the entire picture Simmons (you are simply refusing to give full details - which videoplayer? Any working samples?) but load_file() function can take a URL as parameter.

So you can try
$xml = simplexml load_file("<cms:link 'playlist.php' />");
The player is videoJS. Its working ok but I'm trying to use PHP code to randomly pick a video from an XML list.
I guess I will have to use javascript instead, which I was trying to avoid.
---
You live many times, but only ever remember your lives.length - 1
---
Image
I don't understand why XML is even a component of this discussion... Perhaps I missed something, but what about the following approach:

Create a clonable template videos.php where each page represents a video. Create editable regions for the video thumbnail as well as the three different media sources - mp4, webm, and ogv.

Code: Select all
<cms:template clonable='1' title='Videos'>
    <cms:editable crop='1' height='264' label='Thumbnail' name='video_thumb' show_preview='1' type='image' width='640'/>
    <cms:editable label='MP4' name='video_mp4' type='file'/>
    <cms:editable label='WebM' name='video_webm' type='file'/>
    <cms:editable label='Ogv' name='video_ogv' type='file'/>
</cms:template>

...

<cms:pages limit='1' masterpage='videos.php' orderby='random'>
    <video id="example_video_1" class="video-js vjs-default-skin vjs-big-play-centered"
        controls preload="auto" width="640" height="264"
        poster="<cms:show video_thumb/>">

        <cms:if video_mp4>
            <source src="<cms:show video_mp4/>" type="video/mp4"/>
        </cms:if>

        <cms:if video_webm>
            <source src="<cms:show video_webm/>" type="video/webm"/>
        </cms:if>

        <cms:if video_ogv>
            <source src="<cms:show video_ogv/>" type="video/ogg"/>
        </cms:if>

    </video>
</cms:pages>
The couch way of doing things (cms:pages) is already implemented around the website and for this very playlist.php file.

This playlist is generated by couch but meant for other websites (affiliates) as well as me to access (as a .XML) and pick videos from.

I assumed that a different site cannot access my couch pages the way I as an admin would, so a .XML file seemed like an alternative.

Bad idea?
---
You live many times, but only ever remember your lives.length - 1
---
Image
8 posts Page 1 of 1