No showing when no record there
2 posts by 2 authors in: Forums > CMS Builder
Last Post: January 4, 2013 (RSS)
By esupport - January 4, 2013
Hi,
This is my code for user downloading file.
<?php foreach ($events_tradeshowsRecord['download'] as $index => $upload): ?>
<b>Download : </b><a href="<?php echo $upload['urlPath'] ?>"><?php echo htmlencode($upload['info1']) ?></a>
<?php endforeach ?>
How to no show if I didn't upload file for user.
The "Download:" can disappear?
I hope only display the "Download:" when there is a file.
Hope you know what I mean.
Thanks!
Jac
By Damon - January 4, 2013
Hi Jac,
Try this code for having the "Download" text not appear if there are no downloads:
<?php foreach ($events_tradeshowsRecord['download'] as $index => $upload): ?>
<?php if($upload['urlPath']) : ?>
<b>Download : </b><a href="<?php echo $upload['urlPath'] ?>"><?php echo htmlencode($upload['info1']) ?></a>
<?php endif; ?>
<?php endforeach ?>
Let me know if this works for you.
Thanks!
Damon Edis - interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/