SonataPageBundle 没有为矩阵区域"header"定义容器



我已经安装了SonatapageBundle并生成所有路由。但是,当我尝试配置索纳塔页面作曲家时,我只有错误:没有针对矩阵区域"标头"定义的容器

这是可能的sonata_page config:

sonata_page:
    multisite: host
    use_streamed_response: true # set the value to false in debug mode or if the reverse proxy does not handle streamed response
    ignore_route_patterns:
        - ^(.*)admin(.*)   # ignore admin route, ie route containing 'admin'
        - ^_(.*)          # ignore symfony routes
    ignore_routes:
        - sonata_page_cache_esi
        - sonata_page_cache_ssi
        - sonata_page_js_sync_cache
        - sonata_page_js_async_cache
        - sonata_cache_esi
        - sonata_cache_ssi
        - sonata_cache_js_async
        - sonata_cache_js_sync
        - sonata_cache_apc
    ignore_uri_patterns:
        - ^/admin/   # ignore admin route, ie route containing 'admin'
    page_defaults:
        homepage: {decorate: false} # disable decoration for homepage, key - is a page route
    default_template: default # template key from templates section, used as default for pages
    templates:
        default:
            path: 'ApplicationSonataPageBundle::demo_layout.html.twig'
            name: 'default'
            containers:
                header:
                    name: Header
                content_top:
                    name: Top content
                content:
                    name: Main content
                content_bottom:
                    name: Bottom content
                footer:
                    name: Footer
            matrix:
                layout: |
                    HHHHHHHH
                    TTTTTTTT
                    TTTTTTTT
                    CCCCCCCC
                    CCCCCCCC
                    BBBBBBBB
                    BBBBBBBB
                    FFFFFFFF
                mapping:
                    H: header
                    T: content_top
                    C: content
                    B: content_bottom
                    F: footer
        2columns:
            path: 'ApplicationSonataPageBundle::demo_2columns_layout.html.twig'
            name: '2 columns layout'
            inherits_containers: default
            containers:
                left_col:
                    name: Left column
                    blocks:
                        - sonata.media.block.media
                        - sonata.media.block.gallery
                        - sonata.media.block.feature_media
                right_col:
                    name: Right column
                    blocks:
                        - sonata.news.block.recent_posts
                        - sonata.order.block.recent_orders
                        - sonata.product.block.recent_products
            matrix:
                layout: |
                    HHHHHHHHHH
                    TTTTTTTTTT
                    TTTTTTTTTT
                    LLLCCCCRRR
                    LLLCCCCRRR
                    BBBBBBBBBB
                    BBBBBBBBBB
                    FFFFFFFFFF
                mapping:
                   H: header
                   T: content_top
                   L: left_col
                   R: right_col
                   C: content
                   B: content_bottom
                   F: footer
    # manage the http errors
    catch_exceptions:
        not_found: [404]    # render 404 page with "not_found" key (name generated: _page_internal_error_{key})
        fatal:     [500]    # so you can use the same page for different http errors or specify specific page for each error

有什么想法吗?问候

好的,我为出了什么问题。这是正确的配置:

sonata_page:
    multisite:             host # host
    use_streamed_response: false # set the value to false in debug mode or if the reverse proxy does not handle streamed response
    ignore_uri_patterns:
        - ^/admin(.*)
        - ^/api/(.*)
    ignore_route_patterns:
        - (.*)admin(.*)     # ignore admin route, ie route containing 'admin'
        - ^_(.*)            # ignore symfony routes
    ignore_routes:
        - sonata_page_cache_esi
        - sonata_page_cache_ssi
        - sonata_page_js_sync_cache
        - sonata_page_js_async_cache
        - sonata_cache_esi
        - sonata_cache_ssi
        - sonata_cache_js_async
        - sonata_cache_js_sync
        - sonata_cache_apc
    cache_invalidation:
        service:  sonata.page.cache.invalidation.simple
        recorder: sonata.page.cache.recorder
        classes:
            "ApplicationSonataPageBundleEntityBlock": getId
    default_template: default
    templates:
        default:
          path: 'ApplicationSonataPageBundle::demo_layout.html.twig'
          name: 'default'
          containers:
             header:
                 name: Header
             content_top:
                 name: Top content
             content:
                 name: Main content
             content_bottom:
                 name: Bottom content
             footer:
                 name: Footer
          matrix:
             layout: |
                 HHHHHHHH
                 TTTTBBBB
                 TTTTBBBB
                 TTTTBBBB
                 TTTTBBBB
                 CCCCCCCC
                 CCCCCCCC
                 FFFFFFFF
             mapping:
                 H: header
                 T: content_top
                 C: content
                 B: content_bottom
                 F: footer
        2columns: { path: 'ApplicationSonataPageBundle::demo_2columns_layout.html.twig', name: '2 columns layout' }
    page_defaults:
        homepage: { decorate: false, enabled: true }

相关内容

  • 没有找到相关文章

最新更新