* However, using the embed value is a one-shot static configuration,
to make this more dynamic you can access the embedding element's
template with the getEmbeddingTemplate() method. This will give you
full access to that template.

That's almost perfect. Too bad I can't, for example, set a value in an
embedded template using a block from the embeding template. Something
like:

template.setBlock("something",
getEmbeddingTemplate().getBlock("somethingElse"));

You can :-)

template.setValue("something", getEmbeddingTemplate().getBlock ("somethingElse"));


This way, the embedded element keep it's template, but the embedding
element has a chance to provide blocks (and maybe values).

* allow the embed value to easily become the template of the embedded
element on-the-fly, this makes it easy to mark up lay-outs and
augment them with behavior.

Maybe not become *the* template of the embedded element, but use the
embeded value as an additional template (from where the element could
fetch blocks and values) would be really, really great. This would be
a nicer version of my first suggestion -- the parent would be able to
provide blocks to the child.

Well, actually I phrased this wrongly, *the* template of an element makes no sense for RIFE since an element isn't tied to a template. It will always be a template that can be used in any way you want.

That's exactly what
Tapestry does, except that the top-level element has a distinct name
and role: the Page.

It would be really awesome if you, who knows Tapestry and is looking in depth at RIFE, write down a comparison of both in the wiki. We regularly get questions about this.

As you've probably noticed, my main point here is finding a way for a
parent element to pass blocks to their children. This is very
important when coding widgets -- they often take care of rendering
standard, well-known parts of a page, with parent providing the part
the widget can't figure out by itself. I think that allowing an
embedded element to receive a "body" would solve this problem:

<!--V 'ELEMENT:red-span'-->
  <!-- any standard RIFE tags can go here -->
<!--/V-->

A very common and particular case is for a widget to just write it's
provided "body" as part of it's template. To tackle a simple example,
think about an element that just renders a <span
color="red">...</span> around whatever it encloses. It's template
could look like this:

<span color="red"><!--V 'EMBEDDED:BODY'/--></span>

where "EMBEDDED:BODY" is a special value, indicating that at this
point the template provided by the embedding element should be
rendered. Now to get a little trickier, let's think about an element
that renders a <span color="something-customizable">...</span>. It's
template could look like this:

<span color="[!V 'color'/]"><!--V 'text'/--></span>

And the embedding element template could look like this:

<!--V 'ELEMENT:colored-span'-->
  <!--BV 'color'-->green<--/BV-->
  <!--BV 'text'-->this would go between the span tag<!--/BV-->
<!--/V-->

You can achieve this already now, but it takes some setting up to get a dynamic template from the embed value. I think that adding the feature to make this easy (via a getEmbedTemplate method) should make everything you want possible.

Well, you probably got my idea by now: setting up a way to embed
elements, and exchange blocks of template between an embedded element
and it's container.

As I showed above this is possible, using setValue and not setBlock. The latter always works inside the same template.

--
Geert Bevin                       Uwyn bvba
"Use what you need"               Avenue de Scailmont 34
http://www.uwyn.com               7170 Manage, Belgium
gbevin[remove] at uwyn dot com    Tel +32 64 84 80 03

PGP Fingerprint : 4E21 6399 CD9E A384 6619  719A C8F4 D40D 309F D6A9
Public PGP key  : available at servers pgp.mit.edu, wwwkeys.pgp.net


_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to