Is it possible to split doLayout on the template destination page?

In the representations of the playback structure, you can perform the main import of the code into the base template file using the doLayout tag.

However, I will say that I have several areas in the base file that are completely separated, for example.

<html>
<head></head>
<body>
<div1>doLayout</div1>
<div2>some text in here thats standard across all views...</div2>
<div3>doLayout..again</div> 
</body>
</html>

So, in my views that use this basic html file, I might want to link the photos in div1 and div 2 to a place in some text, but I want doLayouts to be separated and take into account the content (div2) separating them.

+3
source share
2 answers

Play # {set/}, HTML-. , ( , ).

layout.html:

<head>
    <link href="skin.css'}" rel="stylesheet" type="text/css" media="all" />
    #{get 'moreStyles' /}
</head>

any_page.html:

<div id='normal_dolayout_body'>
    <p>This is the doLayout body</[p>
</div>

#{set 'moreStyles'}
   <link href="extra.css" rel='stylesheet' type='text/css' media='all' />
#{/set}

CSS. #set #include:

layout.html:

<!--div.container start -->
<div class="container">  
<div class="center">
<div id="layout">
        <div id='content'>
    #{doLayout/}
</div>
<div id='sidebar'>
    #{get 'sidebar'/}
    </div>
</div>
</div>
<!--div.container end -->

<!--div.footer start -->
<div class="footer">
    #{get 'promo' /}
    #{get 'footerlinks' /}
</div>
<!--div.footer end -->

any_page.html:

<div id='normal_body'>Will be included by doLayout</div>

<!-- You may have any number of #set tags which will be matched with any #get declared in your main layout. -->
#{set 'promo'}
   #{include 'my_custom_promo.html'/}
#{/set}

#{set 'sidebar'}
    #{if user.isHappy }
        #{include '/Commons/happy_user_sidebar.html' /}
    #{/if}
    #{else}
        #{include '/Commons/default_sidebar.html' /}
    #{/else}
#{/set}

promo sidebar #get placeholder .

, #set include, DRY- , - . , # {sidebar user: user/}, .

+4

doLayout, , , . doLayout extends , , , . , doLayout , , ?

, .

, , - includes. -

#{include 'head.html' /}
your top layout code
#{include 'middle-common.html' /}
your bottom layout code
#{include 'foot.html' /}

include doLayout - doLayout "Java Play!" ?

- CSS . , CSS, .

+1

All Articles