[Seaside] state of the aubergine

Avi Bryant avi@beta4.com
Sat, 20 Apr 2002 20:59:47 -0700 (PDT)


On Sat, 20 Apr 2002, Nevin Pratt wrote:

> First, we *have* to be able to support virtual hosts (the gig at work
> likewise does).  Thus, if you check the IP for "smalltalkpro.com" as
> well as "bountifulbaby.com", you will see they both point to the same
> machine--my server machine.  The squeak server therefore must be able to
> synthesize a different "document Root" based on the incoming URL.

Hmm, haven't really thought much about virtual hosts with Seaside - no
document roots to worry about, and my first thought would be to just
redirect to the appropiate app, so http://foo.com would get
redirected (by apache or whatever) to http://foo.com/seaside/foo.  But
obviously this is an issue when using Comanche for static content.

> However, the requirement of using Dreamweaver for the html
> code severely limits my ability to use the html templating scheme that
> Seaside uses.

This is very interesting, since of course one of the main requirements
for that templating scheme was precisely that it work well with
Dreamweaver.  More below.

> Yes, I realize I can use IAFileTemplate to have a file-based template,
> and have it load in the Dreamweaver html, and this is actually a good
> start.  But, one of the immediate problems hit is how to serve the
> static content found in the Dreamweaver html-- JPG and GIF images, for
> example.  We don't want to have to code an absolute path for these
> static images.  Absolute paths suck-- what if you want to host the site
> somewhere else?  This limitation would also be jumped on by the hounds
> at work.

So, I think the issue here is that the defaults for the <img> tag used to
suck.  It used to be that <img src="@foo"> would create a path binding,
that is, would look for a method named #foo and use the result of that as
the src attribute (appended to the configurable "document root", which
should maybe be renamed to something like "url prefix", of the app).

What it does now is uses a literal binding by default, so if your app is
configured to have a doc root of http://smalltalkpro.com/images, then
<img src="@foo.jpg"> will become
<img src="http://smalltalkpro.com/images/foo.jpg">.  Notice that this
allows images to be served statically (likely even by a different
webserver), without requiring hardcoded paths, or any funny business with
IAKom.  If you want this to be chosen dynamically (like your example of
iterating over all the images in a directory), add an explicit binding to
#resource, ie,

addBindingsTo: template
  (template elementNamed: 'myImage')
    set: #resource toPath: 'currentImage'

I'm not sure exactly when this change occured, but if you grab the latest
source off SSVS it'll have it.

Now, I would like to see a better way of handling resources (so that, for
example, dynamically generated images from within squeak become easier),
and am open to suggestions for how this should work.  But does that solve
your immediate issues with using Dreamweaver?