https://github.com/sensorario/sensorariocommentbundle
My first attempt to make a bundle for symfony2
https://github.com/sensorario/sensorariocommentbundle
Last synced: about 1 year ago
JSON representation
My first attempt to make a bundle for symfony2
- Host: GitHub
- URL: https://github.com/sensorario/sensorariocommentbundle
- Owner: sensorario
- Created: 2012-06-23T21:56:28.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2012-06-30T11:44:53.000Z (almost 14 years ago)
- Last Synced: 2025-02-10T10:53:24.340Z (over 1 year ago)
- Language: PHP
- Size: 180 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Requirements
============
This bundle use jquery. To include it use:
Register Sensorario Namespace
=============================
$loader->registerNamespaces(array(
....
'Sensorario' => __DIR__.'/../vendor/bundles',
....
));
Add Bundle to AppKernel
=======================
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
...
new Sensorario\CommentBundle\SensorarioCommentBundle(),
...
);
}
...
}
Install
=======
Update your deps file
[SensorarioCommentBundle]
git=git://github.com/sensorario/SensorarioCommentBundle.git
target=/bundles/Sensorario/CommentBundle
And install this vendor
$ php bin/vendors install
Update your DB schema with Doctrine
===================================
If you want, can add migrations for update your database.
SensorarioCommentBundle use Comment entity to store comments. So, you must
update your database before start to use this bundle.
$ php app/console doctrine:migrations:diff
$ php app/console doctrine:migrations:migrate
Also, you can update your database schema with:
$ php app/console doctrine:schema:update --force
Install assets
==============
Run this command:
$ php app/console assets:install web/
Add routing
===========
Add this in routing.yml
SensorarioCommentBundle:
resource: "@SensorarioCommentBundle/Controller/"
type: annotation
prefix: /
Usage
=====
Just put this snippet of code on your pages, to comment them. And just remember
to change "unique_id" for each different "thread".
{% render 'SensorarioCommentBundle:Index:index' with {'unique_id': 'home_page'} %}
Nice gui with Twitter Bootstrap
===============================
Also, if you like, can override comments.html.twig template with this. This
template add some icons. Like a trash for delete a comment, a "user" icon near
username, and a clock near comment datetime creation.
{% for commento in comments %}
{{ commento.getCreationDate|date("d/m/Y") }}
{{ commento.author }}: {{ commento.comment }}
{% endfor %}