[Bese-devel] TAL und yaclml

Marco Baringer mb at bese.it
Thu Jul 21 14:29:56 UTC 2005


Friedrich Dominicus <frido at q-software-solutions.de> writes:

> How do I call this tal file and after that how can I use a
> user-written render-on function to render the beginning?

i believe the method you are looking for is ucw::render-template (see
ucw/src/yaclml/yaclml.lisp). you can call that from within any
render-on method, the only thing you'll need to do is create a TAL
environement object (a list of alists, objects or hash tables).

if you're trying to embed render-on methods within TAL files you can
use the ucw:render-component tag, it takes one attribute ucw:component
whcih will be evaluated and must return a component object (usually
somthing like "(current-pane $component)" is sufficent).

of course ucw:render-component does nothing more than call render-on,
so it's exactly the same as the example you pasted with embeddeb lisp
code.

if instead you have a common page layout whcih you want to reuse for
many components then you could use tal:include. The only 'interesting'
characteristc about tal:include is that it's generally used inside
out. each specific page will include the defalut layout and pass it
the code to put in the various parts of the page. example:

my-site-layout.tal:
------------------------------------------------------------------------
<!-- -*- html -*- -->
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:tal="http://common-lisp.net/project/bese/tal/core"
      tal:in-package="idi">
  <head>
    <title tal:content="$title">TITLE</title>
  </head>

  <body>
    <h1 tal:content="$title">TITLE</h1>
    <div id="body" tal:content="$body" tal:escape-html="nil">BODY</div>
  </body>
</html>
------------------------------------------------------------------------

index.tal:
------------------------------------------------------------------------
<tal:include tal:name="my-site-layout.tal"
             xmlns="http://www.w3.org/1999/xhtml"
             xmlns:tal="http://common-lisp.net/project/bese/tal/core"
             xmlns:param="http://common-lisp.net/project/bese/tal/params">
  <param:title>Commercial Agency</param:title>
  <param:body>
    ...
  </param:body>
</tal:include>
------------------------------------------------------------------------

does this help any?

> Are there any suggestions on when to use what approach. When to use
> TAL and when to use yaclml?

i use yaclml as much as i can, falling back to TAL when someone else
takes care of the graphic work, which is the case in most of my
projects.

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