On 25.08.2017 09:13, MarrsAttax wrote:
> Is it possible to share a common block of code between two different
> layouts?  I am writing a full mojo app (not mojo lite) and want to to
> share a common header between two different layouts.

That is what the "include" helper is for.
http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Partial-templates

I have been using it for some time with success, and only now I see you
can even pass parameters to it! :-/

My own use case is mostly flash displays, like this:

% if (stash('error_info')) {
%=    include 'include/error_info_box'
% }
% if (stash('success_message')) {
%=    include 'include/success_box'
% }
% if (stash('info_message')) {
%=    include 'include/info_box'
% }

Now that I see this, I think I even could pass the message type
(error/info/success) through the stash to collapse these three cases to
just one. Hmmm...

Regards, Jürgen.

-- 
Jürgen Nickelsen <[email protected]>
Freie Universität Berlin, ZEDAT/FUDIS https://zedat.fu-berlin.de/FUDIS
Jabber [email protected]; Tel +49.30.838-50740 Fax -450740

-- 
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 https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to