Uploads issue

2 posts by 2 authors in: Forums > CMS Builder
Last Post: April 12, 2017   (RSS)

By willydoit - April 5, 2017

Hi all,

I have created a table of pdf brochures allowing the client to upload pdf's for clients to download. I have a second upload section so that they can assign an image for each pdf.

My problem is that the code linking to the download for the image and the download to the pdf are exactly the same. I want the image when displayed to link to the pdf download but when I insert the code as shown below it links to the actual image instead. I think can understand why which I assume is that it is currently dealing with the foreach statement dealing with the image display and hasn't got to the foreach element of the pdf upload.

My Question is how do I get cmsb to differentiate between the $upload['urlpath for the pdf and the $upload['urlpath for the image. As both download link codes are identical as shown below.

Thanks in advance for any help provided.

<?php echo htmlencode($upload['urlPath']) ?> For the image upload
<?php echo htmlencode($upload['urlPath']) ?> For the PDF File upload

In my listing page I have the following code

 <?php foreach ($brochuresRecords as $record): ?>
        <div class="col-sm-3" align="center">
            <div class="img-thumbnail-brochure">
            <h4 style="color: #ED1C24"><?php echo htmlencode($record['title']) ?></h4>
            <?php foreach ($record['image'] as $index => $upload): ?>
         
                <a href="<?php echo htmlencode($upload['urlPath']) ?>"><img alt="<?php echo htmlencode($record['title']) ?>" class=" img-rounded img-responsive" src="<?php echo htmlencode($upload['thumbUrlPath3']) ?>"></a>
                   <?php endforeach ?>
                <div class="caption">
<?php foreach ($record['upload_brochure'] as $index => $upload): ?>                    
                  <p><a href="<?php echo htmlencode($upload['urlPath']) ?>" target="_blank">Download Brochure</a> </a>
                    <?php endforeach ?>
</p>