Page 1 of 1

How to show attachment URL

PostPosted: Tue Jan 19, 2010 1:05 pm
by kevinwen
I have a field for the file upload and want to show this column in the list view(show all) with the linkable URL of the attachment, so the attachment will be automatically opened in the browser when the cell in the attachment column is clicked. FYI, the database table only stores the file name of the attachment.

I have wrote a renderCell function in the delegate class like following, but it doesn't work because the URL is incorrect:

Code: Select all
    function reference_attachment__renderCell(&$record){
        if ($record->val('reference_attachment') == NULL){
            return $record->strval('reference_attachment');
        } else {
            return '<a href="'.$record->strval('reference_attachment').'">'.$record->strval('reference_attachment').'</a>';
        }
    }


Is there any way to show the actual URL of the attachment without hard-coding with /tables/table_name/field_name/cell_value, just as how xataface handle the attachment in browse mode?

Re: How to show attachment URL

PostPosted: Mon Jan 25, 2010 11:09 am
by shannah
Use display() instead of strval(). This will show the URL.