displaying file uploads
2 posts by 2 authors in: Forums > CMS Builder
Last Post: June 7, 2010 (RSS)
By paulmac - June 7, 2010
Hi
I'm adding a page that just has the option to download and view brochures as pdf files. The code I get from CMSB to insert in my page is as follows:
I don't need the code to display thumbnails or images, the only thing I want it to display is the link to the brochure. How should I modify the code to do this?
I would like to have a title above the list of downloads, the title would simply be Brochures. I only want this to appear if there are brochures to display, so if no brochures are uploaded then the title does not appear.
Thanks for any help.
I'm adding a page that just has the option to download and view brochures as pdf files. The code I get from CMSB to insert in my page is as follows:
<!-- STEP 2a: Display Uploads for field 'brochure' (Paste this anywhere inside STEP2 to display uploads) -->
<!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
<?php foreach ($test_uploadRecord['brochure'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>
<?php elseif ($upload['isImage']): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>
<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>
<?php endif ?>
<?php endforeach ?>
<!-- STEP2a: /Display Uploads -->
I don't need the code to display thumbnails or images, the only thing I want it to display is the link to the brochure. How should I modify the code to do this?
I would like to have a title above the list of downloads, the title would simply be Brochures. I only want this to appear if there are brochures to display, so if no brochures are uploaded then the title does not appear.
Thanks for any help.
Re: [paulmac] displaying file uploads
By Jason - June 7, 2010
Hi,
Assuming that pdf's are the only files being uploaded to the brochure field, you can use this code:
You can replace the code: <h2>Brochures</h2> with whatever title you want. This will only display if there are files that have been uploaded to the "brochure" field.
Give that a try and let me know if you run into any issues.
Assuming that pdf's are the only files being uploaded to the brochure field, you can use this code:
<!-- STEP 2a: Display Uploads for field 'brochure' (Paste this anywhere inside STEP2 to display uploads) -->
<!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
<?php if($test_uploadRecord['brochure']):?>
<h2>Brochures</h2>
<?php foreach ($test_uploadRecord['brochure'] as $upload): ?>
<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>
<?php endforeach ?>
<?php endif ?>
<!-- STEP2a: /Display Uploads -->
You can replace the code: <h2>Brochures</h2> with whatever title you want. This will only display if there are files that have been uploaded to the "brochure" field.
Give that a try and let me know if you run into any issues.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/