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
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, (*2)
You can install it with composer with this command :, (*3)
$ composer create-project piou-piou/ribs-module-comment comment
Before install it, you must be in modules folder of your ribs project, (*4)
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 :, (*5)
$comment = new \modules\comment\app\controller\Comment(); $comments = ["name_of_array" => $comment->getComments("name_of_table", id_number)];
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, (*6)
$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"]);
$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"]);
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 :, (*7)
{{ name_of_array|raw }}
and that's all, enjoy :), (*8)