Simple upload in a list
2 posts by 2 authors in: Forums > CMS Builder
Last Post: March 6, 2018 (RSS)
By Mohaukla - March 3, 2018
I know I am over thinking this but I cannot get an upload to show on my list
The link to the page sorts the list by a particular "type"
....resource_list.php?type=5
Then I have the type list called and the documents themselves called
list($resource_documentsRecords, $resource_documentsMetaData) = getRecords(array(
'tableName' => 'resource_documents',
'loadUploads' => false,
'where' => 'resource_type = '.mysql_escape(@$_REQUEST['type']),
'allowSearch' => true,
));
list($resource_documentstypeRecords, $resource_documentsMetaData) = getRecords(array(
'tableName' => 'resource_documents',
'where' => 'resource_type = '.mysql_escape(@$_REQUEST['type']),
'loadUploads' => true,
'allowSearch' => false,
'limit' => '1',
));
$resource_documentsRecord = @$resource_documentstypeRecords[0]; // get first record
if (!$resource_documentsRecord) { dieWith404("Record type not found!"); } // show error message if no record found
My section is looping the document names and inserting the upload link for each document
The loop works to show the names of the documents
But something is breaking the page in the loop when I inject the upload code
<?php foreach ($resource_documentsRecords as $record): ?>
<?php $uploads = getUploads($options['resource_documents'], 'uploads', $record['num']); ?>
<ul class="h3">
<li><?php foreach ($uploads as $upload): ?><a href="<?php echo $uploads['urlPath'] ?>" target="_blank"><?php endforeach ?><?php echo htmlencode($record['title']) ?></a></li>
</ul>
<?php endforeach ?>
My upload is called 'resource_upload' but I am unable to figure out where that goes into the mix
Thanks for your help
Michael
Owner of Just Rite Design Inc. A growing network of professionals in web design, graphic design, flash development, programming, and audio & video productions.
"Due to budget constraints, the Light at the end of the tunnel will be temporarily out!"
By Dave - March 6, 2018
Hi Michael,
Are you using a recent version of CMSB? If so you can try setting this on the first getRecords() block:
'loadUploads' => true,
And then copying the code from the code generator for displaying uploads? We haven't used the getUploads() function in quite a long time.
Let me know if that works for you.
interactivetools.com