'extends' helper

24 views
Skip to first unread message

Stefan Adams

unread,
Sep 12, 2016, 3:29:39 PM9/12/16
to mojolicious
I have a template and it sets the title:

@@ template.html.ep
% title 'TITLE HERE';

And then I extend it:

@@ extension.html.ep
% extends 'template';

It seems reasonable to me that I should be able to set the title in extension with `% title 'NEW TITLE';` but I cannot; the title that sticks is the one in template.  It seems reasonable to me because I can set a default content block in template that gets overridden by extension, so why not be able to override the title?

Am I expecting unreasonable things of 'extends', i.e. am I misusing / abusing 'extends' per its intended purpose?  Is the best / only way to handle this to set the title in the Controller?

sri

unread,
Sep 12, 2016, 3:56:14 PM9/12/16
to Mojolicious
I have a template and it sets the title:

@@ template.html.ep
% title 'TITLE HERE';

And then I extend it:

@@ extension.html.ep
% extends 'template';

It seems reasonable to me that I should be able to set the title in extension with `% title 'NEW TITLE';` but I cannot; the title that sticks is the one in template.

It can't work that way, because "extension.html.ep" is executed first.

--
sebastian
Reply all
Reply to author
Forward
0 new messages