drwf69817 2011-07-23 23:54
浏览 11
已采纳

Django版本的Zend的布局?

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

  • 写回答

1条回答 默认 最新

  • dongyongju9560 2011-07-23 23:57
    关注

    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 %}
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突