How to show attachment URL

A place for users and developers of the Xataface to discuss and receive support.

How to show attachment URL

Postby kevinwen » Tue Jan 19, 2010 1:05 pm

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?
kevinwen
 
Posts: 109
Joined: Mon Dec 28, 2009 3:44 pm

Re: How to show attachment URL

Postby shannah » Mon Jan 25, 2010 11:09 am

Use display() instead of strval(). This will show the URL.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 11 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved