Conversation
View/post.php
Outdated
| <?php endif ?> | ||
|
|
||
| <h4>Add a new comment</h4> | ||
| <form action="<?=ROOT_URL?>?p=comment&a=add" method="post"> |
There was a problem hiding this comment.
Could you use the & HTML entity & instead?
Model/Comment.php
Outdated
|
|
||
| public function __construct() | ||
| { | ||
| $this->oDb = new \TestProject\Engine\Db; |
There was a problem hiding this comment.
I think it might be better to extend this class to Blog (similar to the Admin model) you can can get rid of the constructor).
Model/Comment.php
Outdated
|
|
||
| namespace TestProject\Model; | ||
|
|
||
| class Comment |
There was a problem hiding this comment.
Maybe, extend it to Blog class Comment extends Blog
Model/Comment.php
Outdated
|
|
||
| class Comment | ||
| { | ||
| protected $oDb; |
There was a problem hiding this comment.
And then, if so, remove $oDb property
Controller/Comment.php
Outdated
|
|
||
| namespace TestProject\Controller; | ||
|
|
||
| class Comment |
There was a problem hiding this comment.
Same thing here. Might be a good idea to extend to Blog, so you won't have to initialize session and you will be able to reuse the parent $oUtil object.
And call the parent constructor in Comment constructor.
Controller/Comment.php
Outdated
|
|
||
| /** Get the Model class in all the controller class **/ | ||
| $this->oUtil->getModel('Comment'); | ||
| $this->oModel = new \TestProject\Model\Comment; |
There was a problem hiding this comment.
And then, maybe rename $oModel to oCommentModel to avoid confusion with its parent Blog class
|
Hi Serge! I really appreciate your PR! 😄 Really nice changes overall! Please find a few notes/suggestions |
|
That looks good to me @Kishiko Thanx |
| @@ -26,6 +26,7 @@ public function __construct() | |||
| /** Get the Model class in all the controller class **/ | |||
| $this->oUtil->getModel('Blog'); | |||
There was a problem hiding this comment.
I'm pretty sure you will need $this->oUtil->getModel('Comment'); after $this->oUtil->getModel('Blog'); in order to include the file, since the SPL autoload isn't done for the Model classes.
| { | ||
| public function __construct() | ||
| { | ||
| $this->oUtil = new \TestProject\Engine\Util; |
There was a problem hiding this comment.
If you done what I tell you in my previous above comment, you can just remove the constructor here, so PHP will automatically call the parent constructor
|
Let me know if everything works well after my suggestion @Kishiko? |
|
@Kishiko Hope everything is fine? Let me know if my change request was clear for you? |
|
Hey @Kishiko Let me know if you get a chance to read my request. |
I've added the comment feature. So, everyone can be able to comment a post by writing down its name and the content of its comment.