Re: [chris] Detect "empty" photo value (again)
Thanks Chris...Actually what you suggested, is what I already had...But there is a more efficient way to do it...I know the syntax from a former version of cmsBuilder, but I'm trying to implement it in a newer version...Here's what I mean:
In cmsBuilder version v1.09:[/#ff0000]
<?php
$listing_agent=$record['listing_agent'];
require_once "/usr/www/users/decaro/kellyassociates/decaro/cmsAdmin/lib/viewer_functions.php";
$options2 = array(); // NOTE: see online documentation for more details on these options
$options2['tableName'] = 'agents_ka'; // (REQUIRED) MySQL tablename to list record from. Example: "article";
$options2['recordNum'] = ''; // (optional) Record number to display. Example: "1"; Defaults to number on end of url, then 1
$options2['where'] = "full_name='".$listing_agent."'"; // (ADVANCED) MySQL WHERE conditions to use INSTEAD of recordNum to look up record. Example: "fieldname = 'value'"
$record2 = getRecord($options2);
//echo $record2['email'];
?>
<!--load this variable in order to test for no main photo-->
<?php $uploadList = getUploads($options['tableName'], 'main_photo', $record['num']); ?>
<?php if (empty($uploadList)): ?> [/#0080ff](this works in older version)
[/#000000] <img id="mainPix" src="images/photoscomingsoon_450_300.jpg" width="600" height="400" border="0" /><br/>
<?php endif ?>
Now, in v1.33 I'm working with this:[/#ff0080]
<?php
require_once "/usr/www/users/decaroii/cmsAdmin/lib/viewer_functions.php";
list($agentsRecords, $agentsMetaData) = getRecords(array(
'tableName' => 'agents',
'orderBy' => 'lastname ASC',
));
?>
<?php foreach ($agentsRecords as $record): ?>
<?php if (empty($record['agent_image_big']) && $record['bio']=='')
{ ?>
<a href="#" onclick="javascript:alert('<?php echo $record['agent_name'] ?>\'s homepage is currently under construction...');"><?php echo $record['agent_name'] ?></a><br>
[/#008000] <?php
}else if($record['bio']=='').......etc, etc, etc......end foreach loop...
The code in green above works, but I don't think it's reliable...
Doug had sent me the code for v1.09
<?php $uploadList = getUploads($options['tableName'], 'main_photo', $record['num']); ?>
<?php if (empty($uploadList)): ?>
but I can't get that code to work in 1.33 (changed $options['tableName'] to a few different variations, and substituted the new field in place of 'main_photo' but with no luck)...
Anyway hope that's somewhat clear...Any ideas...
Thanks, Rick