Image linked to PDF document

14 posts by 6 authors in: Forums > CMS Builder
Last Post: October 17, 2009   (RSS)

Thanks Chris, what would the viewer look like in Admin to make this work?
Graphic Lingoes
www.graphiclingoes.com

Re: [GraphicLingoes] Image linked to PDF document

[font "Calibri"]Chris you are the man! Your solution worked like a charm. Disregard my question about what should the viewer look like. The original viewer I set up worked just fine. For anyone else that may read this here was my challenge and thanks to Chris' solution the resolution is below that:

[font "Calibri"]

[font "Calibri"]CHALLENGE:

[font "Calibri"]My client wanted to be able to upload multiple pdf documents for each record in a multi-record section. Easy enough with the upload feature that the CMS builder supplies. The challenging part was they also wanted to be able to upload an image for each separate pdf document on each multi-record in the section. So when you click on the image the corresponding pdf document would launch.


[font "Calibri"]RESOLUTION:

[font "Calibri"]Create a multi-record viewer with two upload features one with a table name of image_upload and another one with a table name of pdf_upload. Generate the code using the code generator as you normally would then add Chris' solution to the body of your page where you want the images to show up that link to the pdfs:
[font "Calibri"]
<?php $count = min( sizeof($record['image_upload']), sizeof($record['pdf_upload']) ); ?>
[font "Calibri"]<?php if ($count > 0): ?>
[font "Calibri"] <?php foreach(range(0, $count - 1) as $index): ?>
[font "Calibri"] <?php $image_upload = $record['image_upload'][$index]; ?>
[font "Calibri"] <?php $pdf_upload = $record['pdf_upload'][$index]; ?>
[font "Calibri"] <a href="<?php echo $pdf_upload['urlPath'] ?>">
[font "Calibri"]<img src="<?php echo $image_upload['urlPath'] ?>" width="<?php echo $image_upload['width'] ?>" height="<?php echo $image_upload['height'] ?>" alt='' /> </a>
[font "Calibri"] <?php endforeach ?>
[font "Calibri"] <? endif ?>

[font "Calibri"]Again, thanks Chris, this really helped me out.

[font "Calibri"]Mike (GraphicLingoes)
Graphic Lingoes
www.graphiclingoes.com

Re: [GraphicLingoes] Image linked to PDF document

By Chris - October 13, 2009

No problem. Glad to help! :)
All the best,
Chris