Jason van Zyl wrote:
<snip />
>
>
> The module gets executed twice, but rendering doesn't happen twice.
>
<snip />
> >
> > When I render the page CreateAccount.vm, I may want to set the
> > title of the page to "Create an Account". Unfortunately, the
> > <title> attribute of the page has already been set by this point.
> > (see layouts/Default.vm). There would be no way to change it at
> > this point. #1 or #2 above solve this problem.
>
> Not following.
>
> If you use something like
>
> <head>
> <body>
> <head>
> <title>$page.title</title>
> ...
> </body>
> </html>
>
> In they layout template and use
> $page.setTitle("Create an Account")
>
> Than the title will be set, and it will be set in the template
> where it should be controlled by the designer.
>
The $page.setTitle("xx") is not working, i believe. If the target is
rendered after the layout has already used $page.Title, it just prints
out "$page.Title". In 2.1 the target is rendered first and its result
stored for insertion into the layout. This allows it to affect
variables used in the layout. It is definitely preferred to render the
target in-line as it can be more efficient, but I am not sure how the
process you describe above works when structured this way.
It is handled differently in the JSP tags (which you stated will likely
no longer be used) since JSP requires in-line rendering. The tags allow
for partial template rendering: once for text that should go at the
beginning of the document (e.g. <head>) and then again for stuff that
comes later.
How does
layout
-------
$page.Title
$renderer.render("MyPage.vm")
MyPage.vm
---------
$page.setTitle("my start page")
work?
john mcnally
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]