Skip to content
This repository was archived by the owner on Feb 2, 2018. It is now read-only.
Piou-piouPublic archive

About

This a blog module wich it run under Ribs-framework 2.3.5.6 and more. It can be used with any ribs module which run over Ribs 2.3.5.6

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

47 Commits

Folders and files

Repository files navigation

ribs-module-comment

Build Status Scrutinizer Code Quality

This comment module wich it run under Ribs-framework all version. It can be used with any ribs module which run over Ribs 2.3.5.6

Install

You can install it with composer with this command :

$ composer create-project piou-piou/ribs-module-comment comment

Before install it, you must be in modules folder of your ribs project

To use it

Explanations to call the module in controller

In the controller of any module, before to create $arr value wich will be used in twig initialise getting of the comments. To do this it's very simple, you have to do inly those two lines :

$comment = new \modules\comment\app\controller\Comment();
$comments = ["name_of_array" => $comment->getComments("name_of_table", id_number)];

Explanations of the var

  • name_of_array : define the name of the array wich will be used for twig call in template
  • name_of_table : the name of the table to associate comment to a page or a specific module
  • id_number : the id in the table name to associate comment to a specific page, article, ...

Example for the controller

For exemple you have the blog module activated on your website, to add comment on articles you have to change controller that get an article

Controller without comments activated

$article = new \modules\blog\app\controller\Article();
$article->getArticle();
	
$category = new \modules\blog\app\controller\Category();
$category->getCategoryArticle();
	
$arr = \modules\blog\app\controller\Blog::getValues();
	
\core\App::setTitle(" ".$arr["blog"]["article"]["title"]);
\core\App::setDescription("". $arr["blog"]["article"]["title"]);

Controller with comments activated

$article = new \modules\blog\app\controller\Article();
$article->getArticle();
	
$category = new \modules\blog\app\controller\Category();
$category->getCategoryArticle();

$comment = new \modules\comment\app\controller\Comment();
$comments = ["comments" => $comment->getComments("_blog_article", 1)];

$arr = array_merge(\modules\blog\app\controller\Blog::getValues(), $comments);
	
\core\App::setTitle(" ".$arr["blog"]["article"]["title"]);
\core\App::setDescription("". $arr["blog"]["article"]["title"]);

Explanations to call the module in views

In views parts you just have to add a simple line of code where you want to display all comments wich were added to twig var before. Where you want to display comments you have to do this :

{{ name_of_array|raw }}

and that's all, enjoy :)

About

This a blog module wich it run under Ribs-framework 2.3.5.6 and more. It can be used with any ribs module which run over Ribs 2.3.5.6

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages