php - How I can insert comments into my new SocialEngine Module


Can you help with the following problem?

I would like to know how I can insert comments to my module.

I have followed the following steps:


  • Model:
    • DbTable:
      • my_new_models -> extends Engine_Db_Table
    • my_new_model -> extends Core_Model_Item_Abstract
      with functions comments and likes
  • controllers:
    • my_new_model_controller -> extends Core_Controller_Action_Standard
    • public function init()
              // Get subject
              $mynewmodel = null;
              $mynewmodel_id = $this->_getParam('mynewmodel_id', $this->_getParam('id', null));
                  $mynewmodel = DEFAULT_VALUE;
              if( !$this->_helper->requireAuth()->setAuthParams('mynewrootmodel_mynewmodel', null, 'view')->isValid() ) return;
              $mynewmodel = Engine_Api::_()->getItem('mynewrootmodel_mynewmodel', $mynewmodel);
              if( $mynewmodel ) {
              // Require subject
              if( !$this->_helper->requireSubject()->isValid() ) {
  • views:
    • scripts:
      • mynewmodel:
        • mynewmodel.tpl
        •  echo $this->action("list", "comment", "core", array("type"=>"mynewrootmodel_mynewmodel", "id"=>$this->mynewmodel->mynewmodel_id)) 

In DB:


    __level_id  type                        name        value   params__
__5 mynewrootmodel_mynewmodel view 1 NULL__
__5 mynewrootmodel_mynewmodel comment 1 NULL__


    __resource_type             resource_id action  role        role_id     value   params__
__mynewrootmodel_mynewmodel *id* view everyone 5 1 NULL__
__mynewrootmodel_mynewmodel *id* comment everyone 5 1 NULL__

I've got the information of modules as Album, Photo and Video

This code don't work.

What steps should I take to insert comments in my module?





There is aComment widget under Core category in layout editor. You can put it on any page. To associate comments (and likes and tags) with a model you also need to havecomments(),likes() andtags() methods implemented in the model class.

People are also looking for solutions to the problem: php - Magento show Product Into Navigation MenuBar?


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.