-
-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comment feature #2
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, extend it to Blog class Comment extends Blog
Model/Comment.php
Outdated
|
||
class Comment | ||
{ | ||
protected $oDb; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And then, if so, remove $oDb property
Controller/Comment.php
Outdated
|
||
namespace TestProject\Controller; | ||
|
||
class Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.