Use two upload fields in a listing
I am working on a site for a teacher providing lessons online that can be downloaded. On one of the pages, we have book "covers" and an associated PDF file for download. I created a multi-record section editor with an upload field for the photo/image and an upload field for the PDF.
My question/problem. On the listing page, I want to display the image with the correct link to the PDF. There may be an actual detail page in the future, but right now I just want to show the image with a link that brings up the PDF.
Since these are upload fields, I'm struggling with the logic of getting those two sets of information together.
Ideas and suggestions are welcome!
Here's the page on the website: http://resursescolare.com/activity-books-new.php
(yes, it has errors ... I'm not finished with it yet)
Here's how I would set that up:
<?php foreach ($test_itemsRecords as $record): ?> <?php foreach ($record['pdf'] as $index => $upload): ?> <a href="<?php echo htmlencode($upload['urlPath']) ?>"> <?php foreach ($record['cover_photo'] as $index => $upload): ?> <img src="<?php echo htmlencode($upload['thumbUrlPath']) ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt=""></a> <?php endforeach ?> <?php endforeach ?> <?php echo htmlencode($record['title']) ?> <?php endforeach ?>
All of the above code is available in the CMSB Code Generator - it just needs to be juggled around to wrap the image with the PDF urlPath.