[Seaside] File to URL

Nick Ager nick.ager at gmail.com
Mon Nov 29 16:33:23 UTC 2010


The render methods are meant to generate html.

> renderContentOn: html
> MyFileLibrary addAllFilesIn: './'.
> MyFileLibrary addFileAt: 'test.pdf'.

These lines add the files all files in the local directory to the file
library and specifically test.pdf *each* time the browser requests a page.
Instead you only need to a file to the file library once. You can do this
programmatically say via the workspace in the your image:

MyFileLibrary addFileAt: '<path to file>/test.pdf'.

or via the web ui, by browsing to /config then selecting
files, MyFileLibrary

>  html image url: (MyFileLibrary urlOf: #testPdf).

You can then render a link to the file by:

renderContentOn: html
    html anchor url: (MyFileLibrary / #testPdf); with: 'click here to
download my pdf'

WAExternalFileLibrary is another option....

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20101129/13275d20/attachment.htm

More information about the seaside mailing list