<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # `include` New in version 1.12: The `include` function was added in Twig 1.12. The `include` function returns the rendered content of a template: <table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2</pre></div></td><td class="code"><div class="highlight"><pre>{{ include('template.html') }} {{ include(some_var) }} </pre></div></td></tr></table> Included templates have access to the variables of the active context. If you are using the filesystem loader, the templates are looked for in thepaths defined by it. The context is passed by default to the template but you can also passadditional variables: <table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2</pre></div></td><td class="code"><div class="highlight"><pre>{# template.html will have access to the variables from the current context and the additional ones provided #} {{ include('template.html', {foo: 'bar'}) }} </pre></div></td></tr></table> You can disable access to the context by setting `with_context` to`false`: <table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2</pre></div></td><td class="code"><div class="highlight"><pre>{# only the foo variable will be accessible #} {{ include('template.html', {foo: 'bar'}, with_context = false) }} </pre></div></td></tr></table> <table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2</pre></div></td><td class="code"><div class="highlight"><pre>{# no variables will be accessible #} {{ include('template.html', with_context = false) }} </pre></div></td></tr></table> And if the expression evaluates to a `Twig_Template` object, Twig will use itdirectly: <table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3 4 5</pre></div></td><td class="code"><div class="highlight"><pre>// {{ include(template) }} $template = $twig-&gt;loadTemplate('some_template.twig'); $twig-&gt;loadTemplate('template.twig')-&gt;display(array('template' =&gt; $template)); </pre></div></td></tr></table> When you set the `ignore_missing` flag, Twig will return an empty string ifthe template does not exist: <table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre>{{ include('sidebar.html', ignore_missing = true) }} </pre></div></td></tr></table> You can also provide a list of templates that are checked for existence beforeinclusion. The first template that exists will be rendered: <table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre>{{ include(['page_detailed.html', 'page.html']) }} </pre></div></td></tr></table> If `ignore_missing` is set, it will fall back to rendering nothing if noneof the templates exist, otherwise it will throw an exception. When including a template created by an end user, you should considersandboxing it: <table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre>{{ include('page.html', sandboxed = true) }} </pre></div></td></tr></table> ### Arguments - `template`: The template to render - `variables`: The variables to pass to the template - `with_context`: Whether to pass the current context variables or not - `ignore_missing`: Whether to ignore missing templates or not - `sandboxed`: Whether to sandbox the template or not
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看