Photo/Image of the day

18 posts by 2 authors in: Forums > CMS Builder
Last Post: October 7, 2008   (RSS)

Re: [grauchut] Photo/Image of the day

By Dave - September 19, 2008

Hi Glenn,

Try this near the bottom of the upload loop:

...
<?php elseif ($upload['isImage']): ?>
<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>"><?php echo $upload['filename'] ?></a><br/>
<?php endif ?>
<?php break ?>
<?php endforeach ?>
<!-- STEP3: /Display Uploads from 'main_images' -->


That will tell it to stop after one "loop" or image shown.

Let me know if that does the trick for you.
Dave Edis - Senior Developer
interactivetools.com

By grauchut - September 20, 2008

Dave,

It works great. One Question. If I reference to the main index images. I noticed if there isn't a picture associated with the entry it doesn't show a picture. Is there a trick to make it skip ones without photos. Thanks Glenn
Glenn Rauchut (Owner) Emergency Designz

Re: [grauchut] Photo/Image of the day

By Dave - September 22, 2008

There's no easy way to do that because the photo data is stored in a different table.

One thing you could do is have a checkbox called "Include in Photos of the Day" and only check that for records you wanted included (which of course would have photos).

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

By grauchut - September 22, 2008

Would this be set up like the feature check box?
Glenn Rauchut (Owner) Emergency Designz

Re: [grauchut] Photo/Image of the day

By Dave - September 22, 2008

Yes, exactly! Except with a different name.

Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com

By grauchut - October 7, 2008

Dave, I added a checkbox for the image to be added. How do I add it into the coding.

<?php
require_once "/webroot/1/2/1212121/1121212/www/cmsAdmin/lib/viewer_functions.php";
$options = array(); // NOTE: see online documentation for more details on these options
$options['tableName'] = 'index'; // (REQUIRED) MySQL tablename to list record from. Example: 'article';
$options['titleField'] = ''; // (optional) MySQL fieldname used in viewer url for search engines. Example: 'title' would display: viewer.php/article_title_here-123
$options['viewerUrl'] = 'indexPage.php'; // (optional) URL of viewer page. Example: '/articles/view.php';
$options['perPage'] = '1'; // (optional) The number of records to display per page. Example: '5'; Defaults to 10.
$options['orderBy'] = 'RAND()'; // (optional) Fieldnames to sort by. Example: 'field1, field2 DESC, field3';[/#ff0000]
$options['pageNum'] = ''; // (optional) Page number of results to display. Example: '1'; Defaults to ?page=# value, or 1 if undefined
$options['where'] = ''; // (ADVANCED) Additional MySQL WHERE conditions. Example: 'fieldname = "value"'
$options['useSeoUrls'] = ''; // (ADVANCED) Set this to '1' for search engine friendly urls: view.php/123 instead of view.php?123 (not supported on all web servers)
list($listRows, $listDetails) = getListRows($options);
?>

Image Of The Day: <?php echo $record['image_of_the_day'] ?>

Thanks Glenn
Glenn Rauchut (Owner) Emergency Designz

Re: [grauchut] Photo/Image of the day

By Dave - October 7, 2008

Hi Glenn,

>How do I add it into the coding.

Try this (replace the existing 'where') line:
$options['where'] = ' image_of_the_day = "1" ';

Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com