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

Jan Rychter jan at rychter.com
Thu Feb 2 12:42:01 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")

Ahem, the parameter passing doesn't seem to work for me. I've
defined

  (deftalpage "example2.ucw" (title) "example.tal")

and example.tal contains (among other lines):

  <title tal:content="$title">TITLE</title>

accessing http://localhost/example2.ucw?title=23 gives me

There is no applicable method for the generic function
  #<STANDARD-GENERIC-FUNCTION IT.BESE.YACLML::FETCH-VALUE (3)>
when called with arguments
  (JWR-WEB::TITLE "23").
   [Condition of type SIMPLE-ERROR]

--J.



More information about the bese-devel mailing list