pdf download

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

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 vyskocil - February 3, 2010

[:)]Thanks Dave,

It works well when using the correct names.

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.