PHPackages                             eight/page-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. eight/page-bundle

ActiveSymfony-bundle[Framework](/categories/framework)

eight/page-bundle
=================

Symfony CMS Bundle for full page editing

1.5.6(1y ago)31.9kMITJavaScriptPHP &gt;7.1.3

Since Sep 5Pushed 1y ago2 watchersCompare

[ Source](https://github.com/matteocaberlotto/eight-page-bundle)[ Packagist](https://packagist.org/packages/eight/page-bundle)[ Docs](https://github.com/matteocaberlotto)[ RSS](/packages/eight-page-bundle/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (5)Versions (75)Used By (0)

EightPageBundle
===============

[](#eightpagebundle)

This bundle allows you to build cms editable pages within minutes without changing too much usual symfony development process. Supports Symfony 2+ up to 3.3 (symfony 4.0 is in roadmap). Just be sure to select the proper version.

- `1.0.x` for Symfony `2.x/3.x` and Twitter Bootstrap `3.3.x`
- `1.3.x` for Symfony `3.x` and Twitter Bootstrap `4.x`

### Roadmap:

[](#roadmap)

- some more tests
- ease admin bundle switching
- ease storage switching
- symfony 4 compatibility

### Features:

[](#features)

- fully editable page properties (title, url, meta, og, ...) inside admin section
- fully editable html layout, blocks tree with predefined widgets inside admin section
- auto form building for in-place content editing
- yml content loader/exporter for programmatic page editing
- very light and easy to admin!

### Installation

[](#installation)

You can clone the sandbox from its repository  or follow instructions below if you need to install CMS on existing project.

1. require via composer

    - composer require eight/page-bundle
2. install and configure dependencies (refer to each installation documentation)

    - sonata admin bundle (for admin structure/navigation)
    - raindrop routing bundle (for dynamic routing)
    - fos user bundle (this is not strictly required)
    - symfony/templating (only for some symfony versions)
    - symfony/assetic-bundle
    - you will also need to manually include twitter bootstrap assets (3.3.\* for 1.0.\* and 4.\* for 1.3.\*)
3. add following lines to config.yml if you need to configure one or more of the following features:

- general encoding
- default title
- default description
- locales
- homepage redirect after locale has been detected
- default controller (you can bind custom controllers to a page, else the default will be used)
- default layout
- assets to be loaded in each page
- admin assets to be appended when editing
- metatags you want to edit in admin area

```
    eight_page:
        encoding: utf-8
        seo_title: My website
        seo_description: My very cool website
        locales: [it]
        redirect_home: homepage
        default_controller: EightPageBundle:Default:index
        default_layout: AppBundle:Default:layout/default.html.twig
        js:
            - /bundles/app/js/bootstrap.min.js
            - /bundles/app/js/main.js
        admin_js:
            - /bundles/app/js/admin.js
        css:
            - /bundles/app/css/bootstrap.min.css
            - /bundles/app/css/main.css
        admin_css:
            - /bundles/app/css/admin.css
        http_metas:
            name:
                - ['keywords', 'text', { required: false }]
                - ['description', 'text', { required: false }]
                - ['robots', 'text', { required: false }]

                - ['google-site-verification', 'text', { required: false }]

                - ['twitter:title', 'text', { required: false }]
                - ['twitter:image', 'text', { required: false }]
                - ['twitter:description', 'text', { required: false }]

            property:
                - ['og:title', 'text', { required: false }]
                - ['og:url', 'text', { required: false }]
                - ['og:type', 'text', { required: false }]
                - ['og:image', 'text', { required: false }]
                - ['og:description', 'text', { required: false }]
                - ['og:site_name', 'text', { required: false }]

            http_equiv:
                - ['Content-type', 'text', { required: false }]
```

4. Update database with `php bin/console doctrine:schema:update --force`

### Creating pages:

[](#creating-pages)

To create a page you need at least 1 layout and 1 block. A layout is simply a simfony page with at least 1 call to `render_page_content()` which is the twig function that dinamically appends blocks. You can have multiple insertion points, just be sure to name each one by passing the label as parameter. EG: `render_page_content('head')`. Once the insertion point is present, in the admin section you can append one of the widgets defined via configuration.

An example layout could look like this:

```

        {{ render_encoding() }}

        {{ render_metadatas() }}

            {% block title %}
                {% if page is not null %}{{ page.title }}{% else %}My website{% endif %}
            {% endblock %}

        {{ eight_stylesheets() }}

            {{ render_static_blocks('head') }}

            {{ render_page_content('default') }}

            {{ render_static_blocks('footer') }}

        {{ eight_javascripts() }}

```

You can use `render_metadatas()` to dinamically render metatags edited in the admin section. `eight_stylesheets()` to dinamically append stylesheet assets to the page (just read on to know how to). `render_page_content()` to dinamically append html editable blocks to the page. `render_static_blocks()` to dinamically append html editable blocks to all of the pages where this slot is rendered. `eight_javascripts()` to dinamically append javascript assets.

By default no widget is added, but you can use some defaults by simply adding this line to config.yml:

```
    - { resource: '@EightPageBundle/Resources/config/widgets.yml' }
```

To nest widgets, call `render_inner_blocks(current_block)` method inside a block template. Please note the 'current\_block' variable as parameter which is mandatory. You can also add a label as second parameters to append multiple childrens to differents position of the current block. E.G.:

```

        {{ render_inner_blocks(current_block, 'right') }}

        {{ render_inner_blocks(current_block, 'left') }}

```

This block template allows you to append elements to both the left and right column (without mixing).

A widget is like a symfony controller with some more features: a predefined layout and an array of editable variables. Each variable has its own database slot (even if not populated). You have to use it as a symfony controller, eg:

```
