Photo Gallery image accredited to person in staff, thereby the photo shows up on staff person's details page using 'where' LIKE

2 posts by 2 authors in: Forums > CMS Builder
Last Post: July 11, 2013   (RSS)

By Mikey - July 10, 2013

So I've got a photo gallery where the site administrator can upload photos to the gallery - taken by staff members of the business. The staff members have their own section within the CMS call staff_directory (which is a "multi" menu type) and the photo gallery is also a "multi" menu type.

Photos are upload the to gallery and there's a "field type - list" called "copyright" that is a pulldown (List Options: Get options from database (advanced)) Section Tablename: staff_directory, Use this field for option values: title, Use this field for option labels: title.

In the staff_directory there's a "title" field type, that represents their position within the business.

    // if(@$staff_directoryRecords['title']) {
        // $inString = $staff_directoryRecords['title'];
        list($gallerySliderRecords, $gallerySliderMetaData) = getRecords(array(
        'tableName'   => 'gallery',
        // 'where'       => "copyright = '$inString'",
        'where'       => " copyright LIKE '%\t".$staff_directoryRecord['title']."\t%'",
        'loadUploads' => true,
        'allowSearch' => false,
        ));
    //} else {
    //  $gallerySliderRecords = array();
    //}

What I'm trying to accomplish is create a photo slider that shows only the photos associated with the staff members in the staff_directory based on if they are accredited for providing the photo. Thereby only photos with their "copyright" shows up in the photo slider powered by the photo gallery. In addition, the slider uses an if statement so if the staff member has provided no photos, the slider does not appear at all - using an if statement... as seen below.

<?php if ($gallerySliderRecords['copyright']): ?>
<div id="slider2">
    <a class="buttons prev" href="#">left</a>
        <div class="viewport">
            <ul class="overview">
<?php foreach ($gallerySliderRecords as $record): ?>
    <?php foreach ($record['gallery_photo'] as $index => $upload): ?>
        <?php if ($upload['hasThumbnail']): ?>
                <li><a href="<?php echo $record['_link'] ?>" title="<?php echo htmlspecialchars($upload['info1']); ?>"><img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="<?php echo htmlspecialchars($upload['info1']); ?>" /></a></li> 
        <?php endif ?>
    <?php endforeach ?>
<?php endforeach ?>   
            </ul>
        </div>
    <a class="buttons next" href="#">right</a>
</div><?php endif ?>

But... the code I'm using does not work, nor can I figure this out. You can see some of my various attempts which have been // commented out in the upper most code block. I've tried various solutions and have given up at this point and seeking help from anyone who can provide some suggestions or a solution on how to get this working. Thanks for any help you can provide.

Zick