Number of uploads as field
4 posts by 2 authors in: Forums > CMS Builder
Last Post: November 15, 2010 (RSS)
By markr - November 12, 2010
I'm using a multi-record editor for photo albums. Each record has a title, cover image, description, and an upload field for images. My list page displays title, etc. to help visitors choose which album to view. So far...nothing special.
But now, I would like to display the number of images in the upload field.
E.g.
Title: Summer 2010
Descripton: My trip to Alaska.
Num of images: 14
Is there a way to count the images in the upload field for display on the list page?
But now, I would like to display the number of images in the upload field.
E.g.
Title: Summer 2010
Descripton: My trip to Alaska.
Num of images: 14
Is there a way to count the images in the upload field for display on the list page?
Re: [markr] Number of uploads as field
By markr - November 13, 2010
Okay, this works...
<?php $n = 0; ?>
<?php foreach ($record['images'] as $upload): ?>
<?php $n++; ?>
<?php endforeach ?>
Images in Album = <?php echo $n; ?>
Anybody have better?
<?php $n = 0; ?>
<?php foreach ($record['images'] as $upload): ?>
<?php $n++; ?>
<?php endforeach ?>
Images in Album = <?php echo $n; ?>
Anybody have better?
Re: [markr] Number of uploads as field
By Chris - November 15, 2010
Hi markr,
You can use the PHP count() function for this:
I hope this helps! :)
You can use the PHP count() function for this:
<?php echo count( $record['images'] ); ?>
I hope this helps! :)
All the best,
Chris
Chris