是否可以使用Symfony的base.html而不扩展它?

时间:2016-03-21 20:13:50

标签: php symfony

我使用Symfony2创建单页面应用程序, 如你所见,base.html.twig(在下面发布)相对较小, 我想做的就是创造一条路线' /'它直接重定向到base.html,而不需要使用不必要的bundle继承。

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>{% block title %} Share with me {% endblock %}</title>

        {% block stylesheets %}
            {% include 'assets/basetemplates.html.twig' %}
        {% endblock %}
    </head>

    <body class="metro mybody">
        {% block channel %}
            <div id="profile_push_container"></div>

            <a href="#channel-close">
                <div class="profile-modal-overlay"></div>
            </a>
        {% endblock %}

        {% block content_form %}
            <div id="content_form_overlay" class="animated fadeIn"></div>

            <div id="content_form" class="animated fadeInDownBig">
                <div class="content_form">
                    <button class="content_cancel_btn" onclick="ContentForm.controller.closeForm();"><i class="icon-cancel-2"></i></button>

                    <div class="form-items" id="form-items">
                        <div class="form-item">
                            <h2 class="content_title">Auto handel</h2>
                        </div>
                    </div>
                </div>
            </div>
        {% endblock %}

       {% block navbar %}
           {% include 'GabrielLayoutBundle:Widgets:navigation.html.twig' %}
       {% endblock %}

       {% block body %}
           <div id="content-loop-container">
               <div id="content-push-in"></div>
               {% block sidebar %}
                   <aside class="sidebar bounceInLeft animated light" id="custom-sidebar-css">
                       <ul id="the_sidebar"></ul>
                   </aside>
               {% endblock %}
           </div>

           <div id="more-button"></div>
       {% endblock %}

        {% block footer %} {% endblock %}

       {% block javascripts  %}
        {% include 'assets/basescripts.html.twig' %}
       {% endblock %}
    </body>
</html>

这似乎不起作用,它找到模板但阻止我使用树枝功能

$collection->add('home_route', new Route('/', array(
    '_controller'  => 'FrameworkBundle:Template:template',
    'template'     => '<path>/views/base.html.twig',
)));

0 个答案:

没有答案