[Seaside] is dynamic href possible?

Kamil Kukura kamk@volny.cz
Tue, 18 Jun 2002 23:08:12 +0200


Rob Whitfield wrote:
 > I'd like to do something like:
 >
 > <a href="resource/[fileName]">click here</a>
 >
 > where fileName equals something like 'tmpName0003.pdf'
 >
 > The goal is to be able to allow  a user to view a file that results from
 > some processing done by my seaside application.  The file name isn't
 > known until execution time.
 >
 > When I try the above it seems that seaside is not performing the
 > substitution, possibly because it disallows substitution inside the tag
 > (just guessing). When I hover over the link I see that the URL literally
 > contains  [fileName] instead of tmpName0003.pdf

Yes, seaside is not meant to be substitution engine. It rather parses
HTML source into the components that are presented as classes. They can
be bound (as of seaside 0.93) to instance variables or methods or to
implicit bindings (hope I'm right, Avi :). So the link mentioned above
should be something like:

<a sea:id="pdflink">click here</a>

made up with binding like:

addBindingsTo: template
     (template elementNamed: 'pdflink')
        bind: #href toPath: 'pdfFileName'.

where 'pdfFileName' is either method giving out or instance variable
holding the href attribute's content.

-- 
Kamil