KitpagesUserGeneratedBundle
Used for common user generated contents like comments, rating,..., (*1)
For the moment there is only comments with the following features :, (*2)
- moderation
- email to webmaster
URL : http://www.kitpages.fr/fr/cms/108/kitpagesusergeneratedbundle (in french), (*3)
Current status
Beta state, (*4)
comming soon :, (*5)
Installation
If you are using DEPS
:, (*6)
[gedmo-doctrine-extensions]
git=http://github.com/l3pp4rd/DoctrineExtensions.git
target=/gedmo-doctrine-extensions
[StofDoctrineExtensionsBundle]
git=https://github.com/stof/StofDoctrineExtensionsBundle.git
target=/bundles/Stof/DoctrineExtensionsBundle
[KitpagesUtilBundle]
git=https://github.com/kitpages/KitpagesUtilBundle.git
target=/bundles/Kitpages/UtilBundle
[KitpagesUserGeneratedBundle]
git=https://github.com/kitpages/KitpagesUserGeneratedBundle.git
target=/bundles/Kitpages/UserGeneratedBundle
Add Kitpages
namespace to your autoloader :, (*7)
``` php
<?php // app/autoload.php, (*8)
$loader->registerNamespaces(array(
// ...
'Gedmo' => DIR.'/../vendor/gedmo-doctrine-extensions/lib',
'Stof' => DIR.'/../vendor/bundles',
'Kitpages' => DIR.'/../vendor/bundles',
));, (*9)
Enable the bundles in your kernel :
``` php
<?php // app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
new Kitpages\UtilBundle\KitpagesUtilBundle(),
new Kitpages\UserGeneratedBundle\KitpagesUserGeneratedBundle(),
);
}
Import the routing file :, (*10)
``` yaml, (*11)
app/config/routing.yml
KitpagesUserGeneratedBundle:
resource: "@KitpagesUserGeneratedBundle/Resources/config/routing.xml", (*12)
Configure KitpagesUserGenerated :
``` yaml
# app/config/config.yml
kitpages_user_generated:
comment:
default_status: "validated"
from_email: "webmaster@mywebsite.fr"
admin_email_list: ["admin@mywebsite.fr"]
Configure StofDoctrineExtensionsBundle :, (*13)
``` yaml, (*14)
app/config/config.yml
stof_doctrine_extensions:
default_locale: en_US
orm:
default:
timestampable: true
sortable: true
sluggable: true
tree: true, (*15)
And then update your database schema :
``` bash
php app/console doctrine:schema:update
User's guide
If you want to add a comment system in a given page, you should add this code
wherever you want in your twig template :, (*16)
html
<h3>Form to add a comment</h3>
{% render 'KitpagesUserGeneratedBundle:Comment:newPost' with {
'itemReference': 'myItem'
} %}
<h3>commentList</h3>
{% render 'KitpagesUserGeneratedBundle:Comment:displayPostList' with {
'itemReference': 'myItem'
} %}
, (*17)
The "itemReference" parameter is a reference to a comment list. For example if you
want comments on the product #45 of your shop, you can use "product-45" as itemReference, (*18)