pdf download

5 posts by 3 authors in: Forums > CMS Builder
Last Post: February 3, 2010   (RSS)

By vyskocil - February 3, 2010

I created a multi record editor for the purpose of document management type system using categories. everything seems to work fine with one exception. the file name is the link to download the pdf file. There are the extra custom info fields. Default names = title and caption. I would like to be able to use one or the other of those as the link in place of the file name. I just tried using the generated code and turned off the echo for the file name and tried to add in the field name title / caption. I get error msg. I have search the forum, lots on using images for links but can't find what I need to do to use one of the custom info fields.

Thanks

.

Re: [vyskocil] pdf download

By Dave - February 3, 2010

Hi vyskocil,

The custom info fields for uploads are available as:
<?php echo $upload['info1'] ?>
<?php echo $upload['info2'] ?>

Give that a try or post a few lines of code that display your attachment and I'll take a look.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [vyskocil] pdf download

By gkornbluth - February 3, 2010

Hi vyskocil,

The Title and Caption are only default field labels (displayed in your upload box dialog after an upload). You can change them to anything that you want to and you can use the info1, info2, info3, field names for any purpose.

A link using the info1 field as a URL might look like this:<a href="<?php echo $upload[info1'] ?>">Download <?php echo $upload['filename'] ?></a>

By the way, any time you are using a URL that is manually entered into a field, it's a good idea to test for the existence of an http: in the URL otherwise you'll stand a chance of broken links.

Here's an excerpt from my CMSB Cookbook http://www.thecmsbcookbook.com that explains how:

Just before the specific link code (inside the upload foreach loop), insert this (for info1 as the URL)<?php if (!preg_match("/^http:\/\//i", $upload['info1'])) {
$upload['info1'] = "http://" . $upload['info1']; }
?><?php endif ?>


Hope that clarifies the issue.

Best,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] pdf download

By vyskocil - February 3, 2010

Thanks Jerry,

I did get your book. Lots of great information. Just didn't put two and two together. I was using the variable names and not the field names. There is sure lots of help in this forum. Thanks everyone.