This bundle takes some important decision about persistence, usability and features exposed to the content management user. Please, take into consideration that these decisions could not fit your needs and feel free to override these implementations in your application.
This bundle provides only an admin interface to manage Pages and related Menu Nodes. The user is not able to manage Routes which are auto generated by configuration. The persistence layer used by this bundle is Doctrine PHPCR.
All Pages are placed under /cms/content/page
path of the PHPCR repositotory and the user cannot create Pages hierarchly (all pages are created on the same level). The PHPCR identifier of every page is auto generated from with an uniqid
. Pages's Routes are auto generated (through CMF AutoRoutingBundle) and are placed under /cms/routes
path of PHPCR repository. The route is autogenerated with a slug version of Page's title. For example, the route for the "About Us" page is created at /cms/routes/about-us
PHPCR path. /cms/routes
is also the base path for CMF's dynamic routing so the "About Us" page is reachable at URL http://mydomain.com/about-us. The user is not able to change routes for pages; only autogeneration is available.
All Menu Nodes are placed under /cms/menu
path of the PHPCR repository. This bundle defines a custom initializer that creates the Menus defined in configuration. So, for example, if you configure {main: Main Menu, footer: Footer Menu}
menus, they will be created under /cms/menu
. The user is able to create menu nodes hierachly (under one of the confiugred menus). Menu Nodes can refer content under /cms/content
or can point to custom URI. The user can manage Page's Menu Nodes directly from Page form.
This bundle has been tested on the following dependencies.
"php": ">=5.3.3",
"symfony/symfony": "~2.5",
"doctrine/doctrine-bundle": "~1.2",
"doctrine/data-fixtures": "~1.0",
"doctrine/doctrine-cache-bundle": "~1.0",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0",
"sensio/framework-extra-bundle": "~3.0",
"incenteev/composer-parameter-handler": "~2.0",
"nelmio/alice": "~1.0",
Install Symfony2 standard edition and ensure that the following parameters are in your app/config/parameters.yml.dist
:
parameters:
database_driver: pdo_mysql
database_host: 127.0.0.1
database_port: ~
database_name: symfony
database_user: root
database_password: ~
# You should uncomment this if you want use pdo_sqlite
database_path: null
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: ~
mailer_password: ~
# A secret key that's used to generate certain security-related tokens
secret: ThisTokenIsNotSoSecretChangeIt
phpcr_backend:
type: doctrinedbal
connection: default
caches:
meta: doctrine_cache.providers.phpcr_meta
nodes: doctrine_cache.providers.phpcr_nodes
phpcr_workspace: default
phpcr_user: admin
phpcr_password: admin
locale: it # Feel free to use another locale but provided translations are only in italian for now
Then and then add the dependency to this bundle in your composer.json
:
$ composer require pugx/cmf-page-bundle
You also have to add downloadCreateAndCkeditor
composer script handler to your composer.json
:
// ...
"scripts": {
"post-install-cmd": [
// ...
"Symfony\\Cmf\\Bundle\\CreateBundle\\Composer\\ScriptHandler::downloadCreateAndCkeditor"
],
"post-update-cmd": [
// ...
"Symfony\\Cmf\\Bundle\\CreateBundle\\Composer\\ScriptHandler::downloadCreateAndCkeditor",
]
},
// ...
And run composer update pugx/cmf-page-bundle
.
Now you have to add Symfony CMF bundles and PUGXCmfPageBundle
to your AppKernel
:
public function registerBundles()
{
$bundles = array(
// ...
// Symfony CMF Bundles
new Doctrine\Bundle\PHPCRBundle\DoctrinePHPCRBundle(),
new Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(),
new Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle(),
new Symfony\Cmf\Bundle\RoutingAutoBundle\CmfRoutingAutoBundle(),
new Symfony\Cmf\Bundle\BlockBundle\CmfBlockBundle(),
new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
new Symfony\Cmf\Bundle\TreeBrowserBundle\CmfTreeBrowserBundle(),
new Sonata\BlockBundle\SonataBlockBundle(),
new Sonata\CoreBundle\SonataCoreBundle(),
new Sonata\jQueryBundle\SonatajQueryBundle(),
new Sonata\AdminBundle\SonataAdminBundle(),
new Sonata\DoctrinePHPCRAdminBundle\SonataDoctrinePHPCRAdminBundle(),
new Symfony\Cmf\Bundle\MenuBundle\CmfMenuBundle(),
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
new FOS\RestBundle\FOSRestBundle(),
new JMS\SerializerBundle\JMSSerializerBundle(),
new Sonata\SeoBundle\SonataSeoBundle(),
new Symfony\Cmf\Bundle\SeoBundle\CmfSeoBundle(),
new PUGX\Cmf\PageBundle\PUGXCmfPageBundle(),
new Symfony\Cmf\Bundle\CoreBundle\CmfCoreBundle(),
);
// ...
Pay attention that CmfCoreBundle
must be loaded after any bundle which prepend config (such as PUGXCmfPageBundle
) because in CmfCoreExtension::prepend()
it copies configuration for others CMF bundles. So because PUGXCmfPageBundle
would prepend configuration for cmf_core
it must be loaded before CmfCoreBundle
to correctly copy such config on other CMF bundles.
Configure the site title, an admin logo and which menus your site requires by adding the proper configuration in your app/config/config.yml
:
pugx_cmf_page:
title: My Awesome Site
description: Put here the website default meta description
keywords: default, meta, keywords, here
admin_logo: bundles/frontend/images/apple-touch-icon.png
menu: { main: "Main Menu", footer: "Footer Menu" }
Then add the routing to your application in the app/config/routing.yml
:
pugx_cmf_page_bundle:
resource: "@PUGXCmfPageBundle/Resources/config/routing.yml"
type: yaml
Finally you have to create the database, initialize the PHPCR repository and install web assets:
$ php app/console doctrine:database:create
$ php app/console doctrine:phpcr:init:dbal
$ php app/console doctrine:phpcr:repository:init
$ php app/console assets:install
Go to /app_dev.php/admin/dashboard
and start using it.