This topic is locked

Help on download link

3/28/2008 7:52:27 AM
PHPRunner General questions
M
mmponline author

I was provided with the following code to replace the file name with a piece of text. This is VERY helpful to replace long file names with a piece of text.

$row[$col."Link3_value"] = "<a href='products_download.php?field=Link3&key1=". $data["ProdID"] ."'>Download document...</a>";


It works fine... however, this link shows up whether a value exists or not. How can I change it to only show the text (Download document...) if there is an actual file loaded in this field.
Thanks for help!

J
Jane 3/28/2008

Stephan,
just add IF condition before:

if ($row[$col."Link3_value"])

{

$row[$col."Link3_value"] = "<a href='products_download.php?field=Link3&key1=". $data["ProdID"] ."'>Download document...</a>";

}

M
mmponline author 3/28/2008

Still the same. Shows text in empty values as well.
I use this code on the List page Event: After record Processed.
Should I put it elsewhere?

J
Jane 3/31/2008

Stephan,
try to use this code:

if ($data["Link3"])

{

$row[$col."Link3_value"] = "<a href='products_download.php?field=Link3&key1=". $data["ProdID"] ."'>Download document...</a>";

}

M
mmponline author 4/1/2008

Works 100% - Thanks a 1 000 000 Jane

M
mmponline author 5/15/2009

How and where (Events or custom code) whould I use this code in V5.1
Please assist.

J
Jane 5/18/2009

Hi,
use this code in the List page: After record processed event:

if ($data["Link3"])

{

$record["Link3_value"] = "<a href='products_download.php?field=Link3&key1=". $data["ProdID"] ."'>Download document...</a>";

}