<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # `import` Twig supports putting often used code into [*macros*](#). Thesemacros can go into different templates and get imported from there. There are two ways to import templates. You can import the complete templateinto a variable or request specific macros from it. Imagine we have a helper module that renders forms (called `forms.html`): <table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3 4 5 6 7</pre></div></td><td class="code"><div class="highlight"><pre>{% macro input(name, value, type, size) %} &lt;input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" /&gt; {% endmacro %} {% macro textarea(name, value, rows, cols) %} &lt;textarea name="{{ name }}" rows="{{ rows|default(10) }}" cols="{{ cols|default(40) }}"&gt;{{ value|e }}&lt;/textarea&gt; {% endmacro %} </pre></div></td></tr></table> The easiest and most flexible is importing the whole module into a variable.That way you can access the attributes: <table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3 4 5 6 7 8 9</pre></div></td><td class="code"><div class="highlight"><pre>{% import 'forms.html' as forms %} &lt;dl&gt; &lt;dt&gt;Username&lt;/dt&gt; &lt;dd&gt;{{ forms.input('username') }}&lt;/dd&gt; &lt;dt&gt;Password&lt;/dt&gt; &lt;dd&gt;{{ forms.input('password', null, 'password') }}&lt;/dd&gt; &lt;/dl&gt; &lt;p&gt;{{ forms.textarea('comment') }}&lt;/p&gt; </pre></div></td></tr></table> Alternatively you can import names from the template into the currentnamespace: <table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3 4 5 6 7 8 9</pre></div></td><td class="code"><div class="highlight"><pre>{% from 'forms.html' import input as input_field, textarea %} &lt;dl&gt; &lt;dt&gt;Username&lt;/dt&gt; &lt;dd&gt;{{ input_field('username') }}&lt;/dd&gt; &lt;dt&gt;Password&lt;/dt&gt; &lt;dd&gt;{{ input_field('password', '', 'password') }}&lt;/dd&gt; &lt;/dl&gt; &lt;p&gt;{{ textarea('comment') }}&lt;/p&gt; </pre></div></td></tr></table> Tip To import macros from the current file, use the special `_self` variablefor the source. See also [*macro*](#), [*from*](#)
                  <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>

                              哎呀哎呀视频在线观看