[Bese-devel] Re: looking for advice: mixing applications and other content
Jan Rychter
jan at rychter.com
Thu Feb 2 12:01:35 UTC 2006
> Jan Rychter wrote:
> > The non-application part is not static for the most part, so simple file
> > serving won't do. I'd like to use yaclml or TAL to generate most of the
> > content there, some dynamically and some offline.
> >
> > How do people deal with this using UCW?
>
> with a macro like this: this is not the actual code i use (i don't have
> that code at hand on this machine) but it's the general idea.
>
> (defmacro deftalpage (url args &optional (template-name url))
> "defines an entry-point for url which calls a template and puts all of
> the query-params passed to the url into the page's tal environement (for
> easy access via the $foo syntax"
> `(progn
> (defcomponent ,(intern url :my-package)
> (template-component window-component)
> ((args :initarg :args))
> (:default-initargs :template-name ,template-name))
> (defentry-point ,url (:application *my-app*) ,args
> (call ',(intern url :my-package)
> :args (list ,@(mapcar (lambda (a)
> (if (listp a) (first a) a))
> args))))
> (defmethod template-component-environment nconc
> ((template ,(intern url :my-package)))
> (slot-value template 'args))
> ',url))
>
> and then lots of these:
>
> (deftalpage "" () "index.tal")
> (deftalpage "product" (p-id sku-id) "catalog/product.tal")
> (deftalpage "news" (news-id) "content/news.tal")
Thanks for the very precise advice!
I have one question though -- the component gets called but never
answers. When does it get garbage collected?
> > I've pondered running araneida with TBNL and UCW, but it seems like
> > overkill.
>
> if we could get ucw to drop the session/frame stuff for certain
> entry-points then i'd agree. until then there is an overhead difference
> between the two which may (or may not) make the difference for you.
The overhead difference isn't significant for the moment, but will be in
the future.
A very, very desirable feature would be to have entry-points without
sessions. When the user lands at an entry point, he doesn't get a
session unless he clicks on a link or presents a valid cookie. By
default we present him with a page that possibly contains links leading
to entry points with sessions.
In the case of a blog site, for example, you'd get nice permanent
URLs and low overhead for most content, while still being able to offer
"applications" after the user logs in or enters a particular area of the
site. Best of both worlds, all in the same framework.
--J.
More information about the bese-devel
mailing list