[Bese-devel] Re: looking for advice: mixing applications and other content

Marco Baringer mb at bese.it
Wed Feb 1 12:48:02 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")

> 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.

-- 
-Marco
Ring the bells that still can ring.
Forget the perfect offering.
There is a crack in everything.
That's how the light gets in.
	-Leonard Cohen




More information about the bese-devel mailing list