CMS & Slideshow Pro (LR2)

25 posts by 7 authors in: Forums > CMS Builder
Last Post: June 6, 2010   (RSS)

By Dave - November 2, 2009

Hi sublmnl,

You'd have to have fields for the album title, description, thumbnails, and path in the CMS so you could load those as well. Or some sort of naming convention so it knew what to output there. But basically if you had all your upload fields in one record you could loop over them and display albums like this:

<gallery>

<?php foreach ($photosRecord as $field): ?>
<?php if (!is_array($field)) { continue; } // Skip non upload fields - we know they are all arrays or lists of images ?>

<album title="Title of the Album" description=Short description goes here for all to see" tnpath="/images/gallery/thumb/"
tn="/images/gallery/thumb/3591690865_4e254e3132_o.jpg" lgpath="/images/gallery/">
<?php foreach ( $photosRecord[$field] as $upload): ?>
<img src="<?php echo $upload['filename'] ?>" caption="<?php echo $upload['info1'] ?>" />
<?php endforeach ?>
</album>

<?php endforeach ?>
</gallery>


You'd have to experiment to get the other fields in there, though.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] CMS & Slideshow Pro (LR2)

By sublmnl - March 13, 2010

Hey gang, back again.
I've had a few clients that won't need more albums that often but one we have now.... I'm sure will need to add a bunch. Probably one or two a month.

So to avoid having to go back in there all the time, may I reopen this can of worms?

Dave, I think I follow what you're saying.
Basically put all the images within one upload, but have a checkbox or list to pick what album they belong in. (do I have that right?)

That may get kind of heavy, with our client having anywhere between 20 and 50 photos per album.

Also I've thought about this a lot....with as much (little) knowledge as you and a few others have taught me about PHP.
I'm at a loss as to how to go about writing this so it works and I've done some pretty complex stuff with you guys' help.

see categories
which I have used a bunch for product pages.... thx btw.

By Chris - March 15, 2010

Hi sublmnl,

Let me make sure I understand:

Your client needs multiple galleries, each of which has one or more albums, each of which has one or more uploaded images, each of which has a caption (in addition to its URL)?

Or is there only ever one "gallery"?
All the best,
Chris

Re: [chris] CMS & Slideshow Pro (LR2)

By sublmnl - March 15, 2010 - edited: March 17, 2010

Close!

For us There is always one Gallery but multiple Albums will be added over time.

thus the <gallery> tag in the XML
and mulptiple <album> tags.

The way it stands now we have to create the upload in the section in the CMS and then add the entry with Title, Description, Thumbnail, Thumbnail pathway and Large image Pathway in the XML.php, then the section editor code pulls in the images and the captions from Info1 or Info2.

It would be nice if all we had to do has create the upload in the section in the CMS, and somewhere along the line, the TN, Title Description and pathways would just write themselves in the xml.php, I guess like an array or loop. (?)

(edited to fix incorrect literal syntax [;)] )

By Chris - March 17, 2010

Hi sublmnl,

So, you create a section for each album?

Why not use only one section (called Albums) and create a record for each album? Each record can have an unlimited number of uploaded images. Would that work? If not, why not?

I'd like to help you come up with a better way to manage these albums. :)
All the best,
Chris

Re: [chris] CMS & Slideshow Pro (LR2)

By sublmnl - March 17, 2010

oh so sorry just re-read that.
Yeah we don';t do that. (section)
we have one section and a bunch of uploads.

By Chris - March 18, 2010

Sublmnl and I have switched over to email to figure out a solution.
All the best,
Chris

Re: [chris] CMS & Slideshow Pro (LR2)

By sublmnl - April 27, 2010 - edited: April 27, 2010

Okay after a short hiatus working on a few other sites with CMSB [;)] We're back.

Chris has instructed me to use a multi section editor and that seems to be the right path.

Here's what I/we did:

Created a multi section editor called "multi_photo_gallery"
with fields for: title, description, thumbnail and photos.
note: that is exactly what the field names are called in the table

For the XML.php file I created one that looks like this:

<?php header('Content-type: application/xml; charset=utf-8'); ?>
<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>
<?php

require_once "/home/YOUR/PATH/TO/html/WEBSITE/cmsAdmin/lib/viewer_functions.php";

list($multi_photo_galleryRecords, $multi_photo_galleryMetaData) = getRecords(array(
'tableName' => 'multi_photo_gallery',
'where' => whereRecordNumberInUrl(1),
));

// show error message if no matching record is found
if (!$multi_photo_galleryRecords) {
print "Record not found!";
exit;
}

?>
<gallery>
<?php foreach ($multi_photo_galleryRecords as $record): ?>
<album title="<?php echo $record['title'] ?>" description="<?php echo $record['description'] ?>"
tnpath="/images/uploads/photos/multi_gallery/thumb/" tn="<?php echo @$record['photos'][0]['thumbUrlPath'] ?>"
lgpath="/images/uploads/photos/multi_gallery/">
<?php foreach ($record['photos'] as $upload): ?>
<img src="<?php echo $upload['urlPath'] ?>" caption="<?php echo $upload['info1'] ?>" />
<?php endforeach ?>
</album>
<?php endforeach ?>
</gallery>


A few notes about the code above: I replaced my pathway to the public HTML folder (just for the example) and the TN path and the LG path are hard coded.
Good news: It works, I view the XML in the browser and it loads the two records I have perfectly and pulls the first thumbnail from the folder.
Chris gave me this to use for that function:
<?php echo @$record['photos'][0]['thumbUrlPath'] ?>

Now bad news is I think, or am pretty sure, I have to keep all the uploads for the different albums in the same TN and LG folder locations.
One more Bad news I can not figure out how to just write the pathway to each, thus they are hard coded. So a little more help there would be great.[;)]

Now one more thing I need help with. The actual php file that holds the SSP player has an error in the code that keeps it from rendering:
(Here is a portion of the html source code with the error - note I changed the pathway for this example)

flashvars="xmlfile=http://WEBSITE.com/xml/multi_photos.xml.php?
Notice: Undefined variable: multi_photo_galleryRecord in /home/YOUR/PATH/TO/html/WEBSITE/multi_photos.php on line 68


This is the portion of the source code that I have on the PHP page that causes that error. I have tried both of these and no luck.

flashvars="xmlfile=http://WEBSITE.com/xml/multi_photos.xml.php?<?php echo $multi_photo_galleryRecord['num'] ?>
and
flashvars="xmlfile=http://WEBSITE.com/xml/multi_photos.xml.php?<?php foreach ($multi_photo_galleryRecords as $record): ?>
<?php echo $multi_photo_galleryRecord['num'] ?>
<?php endforeach ?>"


Once I get this error solved We'll have a perfect example to automate albums in a Gallery with SlideShowPro.

Re: [Jason] CMS & Slideshow Pro (LR2)

By sublmnl - April 28, 2010

Well thanks Jason.

Here is the last iteration of my PHP file.
Attachments:

multi_photos_it.php 4K