Flash Image Rotator

10 posts by 3 authors in: Forums > CMS Builder
Last Post: March 9, 2010   (RSS)

Re: [drewh01] Flash Image Rotator

By drewh01 - January 5, 2010 - edited: January 5, 2010

update:

I removed this line from my top load header and it worked!

'where' => whereRecordNumberInUrl(1),

Re: [drewh01] Flash Image Rotator

By Chris - January 5, 2010

Hi drewh01,

Glad to hear you've figured this out. Looks good! :D
All the best,
Chris

Re: [chris] Flash Image Rotator

By sublmnl - March 8, 2010

I wanted to update this as I have been messing around with quite a few PHP to XML things lately. JW image rotator is really nice and so are the other products they have.

Since I couldn't find a how-to, I treated this just like the RSS feed , replacing things as necessary.

(as usual get the XML working outside of the CMS first! to eliminate buggy issues)

Here is the top portion of the code for the original XML file that we are going to replace with the top portion of our images section editor:

<?xml version="1.0" encoding="utf-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">


replace with this:
change your pathways to match your locations! :
<?php header('Content-type: application/xml; charset=utf-8'); ?><?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>
<?php

require_once "/home/content/html/public/cmsAdmin/lib/viewer_functions.php";

list($homepage_imagesRecords, $homepage_imagesMetaData) = getRecords(array(
'tableName' => 'homepage_images',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$homepage_imagesRecord = @$homepage_imagesRecords[0]; // get first record

// show error message if no matching record is found
if (!$homepage_imagesRecord) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}

?>


What I don't understand is why removing this from the above code, actually gets it to work?!

'where' => whereRecordNumberInUrl(1),

if anyone knows that answer, great.

But below is the rest of the code, and I'm only using the <location> tag but you could use all of them and pop in whatever variables you have from your editor, for example using link would be good for each image if they linked to a product etc etc....

<playlist version="1" xmlns="http://xspf.org/ns/0/">
<trackList>

<?php foreach ($homepage_imagesRecord['images'] as $upload): ?>
<track>
<location><?php echo $upload['urlPath'] ?></location>
</track>
<?php endforeach ?>


</trackList>
</playlist>

Re: [sublmnl] Flash Image Rotator

By Chris - March 9, 2010

Hi sublmnl,

What I don't understand is why removing this from the above code, actually gets it to work?!


What URL are you using to access your XML page? With no where clause, getRecords() will simply return the first record in your section. Is your section Multi Record or Single Record?
All the best,
Chris

Re: [chris] Flash Image Rotator

By sublmnl - March 9, 2010 - edited: March 9, 2010

Well its a single record with one section editor that only has an image upload with a limit of 20 total images.

It does work, just need to figure out why taking that line out works - or perhaps, is there a better way to write that xml.php file?

Re: [sublmnl] Flash Image Rotator

By Chris - March 9, 2010

Hi sublmnl,

For a Single Record section, you'll never need a where clause. Taking out that line is the right thing to do. :)

I hope this helps! Please let me know if you have any questions.
All the best,
Chris

Re: [chris] Flash Image Rotator

By sublmnl - March 9, 2010

Thanks.

can I poke you into helping with the limit wysiwyg post we've been running for about a year now?
[cool]

Re: [sublmnl] Flash Image Rotator

By Chris - March 9, 2010

Which post is that?
All the best,
Chris

Re: [chris] Flash Image Rotator

By sublmnl - March 9, 2010

looks like you found it [;)]