Adding Image/File download attribute code1 user found helpful
I have set up a site using the real-estate addon which uses the composer, our client wants to add a property PDF download to the listings page. I have added a Image/File attribute and I can upload a PDF when adding a property but I have no idea how to add the code to the page to make the download work. Just want a Download PDF link on the page. Looking at real_estate_listing.php I guess I need to add
$file_download = $c->getAttribute('file_download'); in the <?php global section but not sure what to add to get the download to work.
anybody know how I can do this?
$page = Page::getCurrentPage(); $f = $page->getAttribute('file_attribute_handle'); $fv = $f->getApprovedVersion(); $url = $fv->getDownloadURL();
Then just create the link.
<a href="<?php echo $url; ?>">Download Listing</a>