简体   繁体   中英

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. 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.

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.

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. 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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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