开发者

Django version of Zend's Layouts?

Doe开发者_如何学编程s Django have something like Zend's Layouts? I use layouts in Zend a lot to provide the common elements of a website (I often call it the 'frame' around the content), e.g. the header, footer, etc. Then I render a view inside the layout to provide the custom content.

Is such a thing possible in Django?


I've never used Zend, but from the sounds of what you are asking, you can use Django's templates.

Basically you are going to create a base.html template that has your 'frame' and you can have other templates inherit from that.

Your base.html will look like

<html>
<head>
<title>{% block title %}title{% endblock %}</title>
</head>
{% block content %}{% endblock %}<br>
</body>
</html>

You can than have your 'child' templates look like:

{% extends "../templates/app/base.html"%}
{% block content %}
words on my page
{% endblock %}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜