Django include 标签

Include

include 标记可以使当前模板中包含模板。

当您的内容块在许多页面上都相同时,这时就非常有用了。

实例

footer.html:

  1. <p>You have reach the bottom of this page, thank you for your time.</p>

testing_tags.html:

  1. <h2>Hello</h2>
  2. <p>This page contains a footer in a template.</p>
  3. {% include 'footer.html' %}
结果

Hello

This page contains a footer in a template.

You have reach the bottom of this page, thank you for your time.