This topic is locked
[SOLVED]

 Display File Link as Image

1/13/2010 1:25:12 PM
ASPRunnerPro General questions
S
stealthwifi author

I have a view page that has files on it, currently the link to the file is the file name i would like the link to be an image (same image for all links)
How would I do that?
I tried changing the code on the HTML view of the page to the below but it doesn't work, just puts a txt link above the image:

<A href={$row.1FileLocation_value}> <IMG height=60 alt="Adobe Icon" src="" width=60 border=0> </A>


If I do the following it puts the link in the image but the link doesnt work:

<A href='{$row.1FileLocation_value}'> <IMG height=60 alt="Adobe Icon" src="" width=60 border=0></A>



result is: http://url/%3Cspan%20id=%22edit1_FileLocation%22%20%3E%3Ca%20href=%22HazCom_download.asp?field=FileLocation&key1=6".>Port%20City-20100113-114211.pdf</a></span>;

Sergey Kornilov admin 1/14/2010

I would suggest to set 'View as' type of FileLocation field to 'Custom' and construct URL manually i.e.

strValue = "<A href='HazCom_download.asp?field=FileLocation&key1=" & strValue & "'><IMG height=60 alt='Adobe Icon' src='img.gif' width=60 border=0></A>"
S
stealthwifi author 1/18/2010

Could I get this in PHP code format as well, I am thinking of converting my project to PHP and want to test this function?
I tried the below but it doesnt seem to work:

$value = "<A href='http://url1.com/files/"; & $value & "' target='_blank'><IMG height=60 alt='Adobe Icon' src='img.gif' width=60 border=0></A>";
J
Jane 1/19/2010
$value = "<A href='http://url1.com/files/".$value."'; target='_blank'><IMG height=60 alt='Adobe Icon' src='img.gif' width=60 border=0></A>";