|
1 |
| -Zend Framework 2 module for self-hosted comments. |
| 1 | +Zend Framework 2 module for drop-in self-hosted comments. |
2 | 2 |
|
3 | 3 | #### Installation
|
4 | 4 |
|
| 5 | +1. Add the module key to your `composer.json` file |
| 6 | +```json |
| 7 | + { |
| 8 | + "require": { |
| 9 | + "robertboloc/rbcomment": "dev-master" |
| 10 | + } |
| 11 | + } |
| 12 | +``` |
| 13 | + |
| 14 | +2. Run `composer update` |
| 15 | + |
| 16 | +3. Import the schema from `data/schema.sql` into your database. |
| 17 | + |
| 18 | +4. Add the new module to your application's modules list in `config/application.config.php` |
| 19 | +```php |
| 20 | + 'modules' => array( |
| 21 | + 'Application', |
| 22 | + 'RbComment', |
| 23 | + ), |
| 24 | +``` |
| 25 | + |
5 | 26 | #### Usage
|
| 27 | + |
| 28 | +In your views use the `rbComment` helper to display the count, the list and a form for adding new comments. Invoke it |
| 29 | +where you want your comments box to appear. Simple isn't it? This helper can be used in any view. |
| 30 | + |
| 31 | +```php |
| 32 | +<?php echo $this->rbComment($theme) ?> |
| 33 | +``` |
| 34 | +The `$theme` parameter is used to specify the theme of the comments box (if none is specified `default` is used). |
| 35 | + |
| 36 | +Currently, the module is designed to allow only one comment box per page, as it uses |
| 37 | +the page uri to identify a thread. |
| 38 | + |
| 39 | +#### Themes |
| 40 | + |
| 41 | +The module comes with 2 themes for now. To implement new ones create a new partial view in `view/theme/yourtheme` using |
| 42 | +as base the existing ones. |
| 43 | +Use your new theme calling `$this->rbComment('yourtheme')` |
| 44 | + |
| 45 | +##### default |
| 46 | +Basic theme with no external dependencies. Contains the minimum styling to make it look decent. |
| 47 | + |
| 48 | +##### uikit |
| 49 | +This theme requires the [UIkit](http://www.getuikit.com/) CSS framework. If you use it in your project this theme |
| 50 | +will make your comments box look awesome. |
| 51 | + |
| 52 | +#### Configuration |
| 53 | +The configuration of the module can be found in `config/module.config.php`. Currently the configurable parameters are: |
| 54 | + |
| 55 | +##### default_visibility |
| 56 | +This parameter controls the visibility of the newly published comments. If set to 1 all new published comments will be |
| 57 | +visible. If 0 they will not be shown. This is useful for moderation. |
0 commit comments