CMSB Ligthbox Integration

6 posts by 3 authors in: Forums > CMS Builder
Last Post: September 26, 2008   (RSS)

By gkornbluth - September 25, 2008

Hi all,

I’ve been trying to set up a page with milkbox (a lightbox derivative).

I’ve set up a section editor as a single page with a fixed number of upload boxes and one image allowed per upload box. I’ve also restricted the thumbnail size to work with my layout.

I’ve uploaded some test images and inserted the code below into the working page in place of the first thumbnail.

No matter what I try I can’t seem to get the page to work.

I’ve included documentation of what I’ve done below.

Hope someone has a handle on what I’m doing wrong.

Thanks,

Jerry Kornbluth

_____________________________________________________________________

The page, without CMSB integration, can be viewed at artistsofpalmbeachcounty.com/jsart.php

Here’s a sample of the code that works on that page with the code replacement marked.

<table border="0" id="gallery" cellspacing="10" cellpadding="0" align="center">

<tr valign="middle">

<td align="center" valign="middle" style="border: 1px solid #ffffff;" width="15%">
<div align="center">
<!-- replaced with above code -–> <a href="art/Images/art10.jpg" rel="milkbox[art]" title="Burlington, Vermont<br>(MooseFest)"><img src="art/Thumbnails/art10t.jpg" alt="" width="100" height="67" border="0" /></a> <–-! End replacement –-> </div>
</td>

<td align="center" valign="middle" style="border: 1px solid #ffffff;" width="14%">
<div align="center">
<a href="art/Images/art1.jpg" rel="milkbox[art]" title="Margulies Collection at the Warehouse, Miami<br>(Anthony Gormley)"><img src="art/Thumbnails/art1t.jpg" alt="" width="67" height="100" border="0" /></a> </div>
</td>

<td align="center" valign="middle" style="border: 1px solid #ffffff;" width="14%">
<div align="center">
<a href="art/Images/art12.jpg" rel="milkbox[art]" title="Scope, Miami<br>(Dennis Oppenheim)"><img src="art/Thumbnails/art12t.jpg" alt="" width="100" height="67" border="0" /></a></div>
</td>
<div align="center">
etc...
_________________________________________________________
This is the code that I’ve put at the top of my page (from the code generator)

<?php

require_once "/hsphere/local/home/apbcweb/artistsofpalmbeachcounty.org/cmsAdmin/lib/viewer_functions.php";

list($js_galleryRecords, $js_galleryMetaData) = getRecords(array(
'tableName' => 'js_gallery',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$js_galleryRecord = @$js_galleryRecords[0]; // get first record

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

_____________________________________________
I tried using the code that Donna has in her article on CMSB/Lightbox integration: http://www.interactivetools.com/news/issue0073.html#2
(substituting only “milkbox[art]” for “lightbox[Homepage]”):

This is the code from Donna’s article:

<?php foreach (getUploads($options['tableName'], 'images', $record['num']) as $upload): ?>

<?php if ($upload['hasThumbnail']): ?>
<a href="<?php echo $upload['urlPath'] ?>" rel="milkbox[art]" title="<?php echo $upload['info1'] ?>">
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight']?>" />
</a>

<?php elseif ($upload['isImage']): ?>
<a href="<?php echo $upload['urlPath'] ?>" rel="milkbox[art]" title="<?php echo $upload['info1'] ?>">
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" />
</a>

<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a>

<?php endif ?>
<?php endforeach ?>


Using that code I get the error:
Notice: Undefined variable: options in /hsphere/local/home/apbcweb/artistsofpalmbeachcounty.org/jsart2.php on line 59 Notice: Undefined variable: record in /hsphere/local/home/apbcweb/artistsofpalmbeachcounty.org/jsart2.php on line 59 getUploads: no 'tableName' value specified!

The rest of the page DOES NOT display.

(The page, with the code from Donna’s article can be viewed at www.artistsofpalmbeachcounty.com/jsart2.php )

______________________________________
If I substitute <?php foreach ($js_galleryRecord['image_1'] as $upload): ?> (from a working gallery page)
for the first line:
<?php foreach (getUploads($options['tableName'], 'images', $record['num']) as $upload): ?>

I get the error:
Warning: Invalid argument supplied for foreach() in /hsphere/local/home/apbcweb/artistsofpalmbeachcounty.org/jsart3.php on line 59

The rest of the page displays normally.

(The page with this code can be viewed at www.artistsofpalmbeachcounty.com/jsart3.php )
The first CMS Builder reference book is now available on-line!

Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] CMSB Ligthbox Integration

By Melanie - September 25, 2008

Jerry,

It looks like you didn't replace with the calls in your cms. It's looking for arguments that don't exist in your system.

Re: [gkornbluth] CMSB Ligthbox Integration

By Dave - September 25, 2008

Hi gkornbluth,

I can't seem to connect to your server to see your demo pages right now (I'm getting a DNS error). But I can give you some tips while we wait for that to sort itself out:

This is the old type of code from the coder generator:
<?php foreach (getUploads($options['tableName'], 'images', $record['num']) as $upload): ?>

Don't use that, use this instead:
<?php foreach ($js_galleryRecord['images'] as $upload): ?>

That will fix the first error, then we can move onto any further issues.

Also, it might make more sense to have one upload field that allows multiple uploads than multiple fields. I'll have to see the mockup pages you posted.

Can you let me know if the server is working again for you? And if that line above helps? Thanks!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] CMSB Ligthbox Integration

By gkornbluth - September 25, 2008

Hi Dave,

The new line of code is in http://artistsofpalmbeachcounty.org/jsart4.php but itgives the same error as jsart3.php did.

Warning: Invalid argument supplied for foreach() in /hsphere/local/home/apbcweb/artistsofpalmbeachcounty.org/jsart4.php on line 59

I've re-sent you the log in info in a private message.

Thanks for taking a look at this

Jerry
The first CMS Builder reference book is now available on-line!

Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] CMSB Ligthbox Integration

By Dave - September 26, 2008

Hi gkornbluth,

I had a look. There was two problems:

The first is that you only have a record in the 'js_gallery' section, but it had a 'removeDate' of Sept 25th, so it was automatically being hidden and it was as if there was no records. I changed it to 2009.

Next, I got a "Undefined index: images ..." error. This is because there's no field called 'images' but many files called image_1, image_2, etc.

I'm not sure if you want to show just one but I swapped images with image_1 and now it's showing the image in that field.

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