简体   繁体   English

奏鸣曲页面捆绑-创建页面

[英]Sonata Page Bundle - creating a page

I'm trying to use Sonata Page Bundle and I've installed it without any issues but I'm having trouble adding blocks to pages. 我正在尝试使用Sonata页面捆绑包,并且已经安装了它,没有任何问题,但是在向页面添加块时遇到了麻烦。 When I looked at Sonata Sandbox I can create page and when I click View Page it will generate blocks automatically which it doesn't do in my project. 当我查看Sonata Sandbox时,我可以创建页面,而当我单击View Page时,它将自动生成在项目中不执行的块。

I have basically copied settings from sonata sandbox. 我基本上已经从奏鸣曲沙箱复制了设置。 Also in sanbox if I'm logged in I can access the page without creating publication which in my project I'm getting an error route not found. 同样在sanbox中,如果我已登录,则无需创建发布即可访问页面,而在我的项目中却找不到错误路由。

cmf_routing:
    chain:
        routers_by_id:
            # enable the DynamicRouter with high priority to allow overwriting configured routes with content
            #symfony_cmf_routing_extra.dynamic_router: 200
            # enable the symfony default router with a lower priority
            sonata.page.router: 150
            router.default: 100

sonata_page:
    multisite:             host # host_with_path
    use_streamed_response: false # 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'

    cache_invalidation:
        service:  sonata.page.cache.invalidation.simple
        recorder: sonata.page.cache.recorder
        classes:
            "Application\Sonata\PageBundle\Entity\Block": getId

    default_template: default
    templates:
        default: { path: 'SonataPageBundle::layout.html.twig', name: 'default' }
        2col: { path: 'SonataPageBundle::2columns_layout.html.twig', name: '2 column' }

    page_defaults:
        homepage: {decorate: false, enabled: true}

    #caches:
    #    esi:
    #        token:    add an unique token here # default is a random value
    #        version:  3                        # version 3 is the default on debian wheezy ...
    #        servers:
    #            # you need to ajust this configuration to match your varnish configuration
    #            - %sonata_page.varnish.command%
    #    ssi:
    #        token:    add an unique token here # default is a random value

    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


# Enable Doctrine to map the provided entities
doctrine:
    orm:
        entity_managers:
            default:
                mappings:
                    ApplicationSonataPageBundle: ~
                    SonataPageBundle: ~  

Thanks for any advice 感谢您的任何建议

1 - You are right, from front-end site, being logged-in, creating page and then clicking on View Page will generate blocks automatically. 1-您是对的,从前端站点登录,创建页面,然后单击“查看页面”将自动生成块。 This is awesome, but unfortunately the feature will be deleted in futur versions (explanations included) 太棒了,但是很遗憾, 该功能将在以后的版本中删除 (包括说明)

To use it for now, read the Full configuration options 要暂时使用它,请阅读完整配置选项

sonata_page:
    (...)
    is_inline_edition_on: true

2 - No idea. 2-不知道 To perform a global publication, just in case: 要执行全局发布,以防万一:

php app/console sonata:page:update-core-routes --site=all
php app/console sonata:page:create-snapshots --site=all

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM