Re: [Dancer-users] defining a variable in a template that the layout can read
Hello, I actually tried this but it doesn't seem to work. I think it's because the Dancer layout is processed separately from the template. I think the SET variables only work in templates that are directly included in the template you're processing now. I'm looking for something that is compatible with the way Dancer handles layouts. I could be doing it wrong. I tried this: In layout.tt I have <% title %> In home.tt I have this <% SET title = 'Home' %> And title in layout.tt remains unset. Thank you, Brian On Thu, Mar 10, 2011 at 7:42 AM, Tobias <tobiash@gmail.com> wrote:
Look at TT's Syntax document: http://template-toolkit.org/docs/manual/Syntax.html You can use "SET" to assign values inside a template, which can be reused later on. HTH --Tobias
On Thu, Mar 10, 2011 at 8:39 AM, Brian E. Lozier <brian@massassi.com> wrote:
I realized that the only user-visible strings that are in my dancer perl code are the titles for pages. It's because I do stuff like this:
template 'foo.tt', { title => 'My Title' };
Is there a way to define title in foo.tt such that the layout template can see it? _______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
participants (1)
-
Brian E. Lozier