> On 14 May 2015, at 2:48 am, Juergen Nickelsen <[email protected]>
> wrote:
>
> for a while I have been trying to get at the name of the template that
> is just being rendered, to use it in the layout.
I can’t answer your question directly, but this requirement sounds like a bit
of a code smell. What are you trying to accomplish?
You should probably be setting something in the stash to drive logic required
for presentation in the layout, not depending on what template is being
rendered.
For example (untested):
sub some_controller_method {
my $self = shift;
$self->stash( has_login_box => 1 );
$self->render(template => ‘foo’);
}
then in the layout:
% if (stash(‘has_login_box’)) {
<div id=“login-box”>
...
</div>
% }
or better:
% if (stash(‘has_login_box’)) {
% include ‘page_bits/login’;
% }
If you literally just want the name of the template, well, I don’t know how to
do that, and I don’t know why you’d want to do that :-)
- Justin
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.