Multi-search direct link to file upload?

3 posts by 2 authors in: Forums > CMS Builder
Last Post: October 18, 2016   (RSS)

By Toledoh - October 11, 2016

Hey Guys.

I'm running multiSearch.php and it is working fine.  

With one section that it's searching I need to link directly to the file uploaded - rather than the list page or the detail page.  Is that possible?

The field is "pdf" - but this doesn't work (as I expected it not to).

<?php if (!$record['field2']): ?>
<p><a href="<?php echo PREFIX_URL ?>/<?php echo $record['field1'] ?>" class="">Read More</a></p>
<?php else: ?>
<p><a href="<?php foreach ($record['pdf'] as $index => $upload): ?><?php echo htmlencode($upload['urlPath']) ?><?php endforeach ?>" class="">View <?php echo $record['field2'] ?></a></p>
<?php endif ?>

Cheers,

Tim (toledoh.com.au)

By Damon - October 17, 2016

Hi Tim,

No, uploads don't work with multi-search. 

That said, you could add a text field (ex.pdf_url) and manually copy and paste the PDF URL into it.

Then this field can be used to display a link to the PDF:

<?php if (!$record['field2']): ?>
  <p><a href="<?php echo PREFIX_URL ?>/<?php echo $record['field1'] ?>" class="">Read More</a></p>
<?php else: ?>
  <p><a href="<?php echo record['field2']; ?>" class="">View PDF</a></p>
<?php endif ?>

To automate the manual process of adding the URL from the uploaded PDF into a PDF URL field, we could write a plugin to automatically do this.

Let me know is this sounds workable.

Thanks!

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/