Giter Site home page Giter Site logo

Comments (8)

ihorchepurnyi avatar ihorchepurnyi commented on May 27, 2024

Hi, if you use the advanced template, you can place this code in the main config for the your backend application. For example, you can place this code after this line. You can then access to comments management section through the following URL: your-backed-application-url/comments/index

from yii2-comments.

jsobers1331 avatar jsobers1331 commented on May 27, 2024

I'm accessing the backend comments sections just fine. I want to modify the code you have in the Default Controller. But it's not picking up my file. Still using yours, even when i did your suggestion above.

from yii2-comments.

ihorchepurnyi avatar ihorchepurnyi commented on May 27, 2024

Do you want override the ManageController?

from yii2-comments.

jsobers1331 avatar jsobers1331 commented on May 27, 2024

Yes

from yii2-comments.

ihorchepurnyi avatar ihorchepurnyi commented on May 27, 2024

Ok, you can create your own controller for example

namespace app\controllers;

class ManageController extends \yii2mod\comments\controllers\ManageController
{
    // your custom index action
    public function actionIndex()
    {
    }
}

And then edit the config:

 'controllerMap' => [
       'comments' => 'app\controllers\ManageController' // your own controller
 ],

from yii2-comments.

jsobers1331 avatar jsobers1331 commented on May 27, 2024

I did that but it didn't work. i placed it after the module section in main config like you suggested and it didn't work. Before i had placed it in the module config like:

'comment' => [
            'class' => 'yii2mod\comments\Module',  
            'controllerMap' => [
                'DefaultController' => 'frontend\controllers\comments\DefaultCommentController'
            ],
        ],

and it didn't work like this either.

from yii2-comments.

ihorchepurnyi avatar ihorchepurnyi commented on May 27, 2024

Ok, now i understand. If you want override the yii2mod\comments\controllers\DefaultController
you can do it by the following code:

  1. Create your own DefaultController
<?php

namespace app\controllers;

use Yii;

class DefaultController extends \yii2mod\comments\controllers\DefaultController
{
    // your custom create  comment action
    public function actionCreate($entity)
    {

    }
}
  1. Modify config
'modules' => [
       'comment' => [
            'class' => 'yii2mod\comments\Module',
            'controllerNamespace' => 'app\controllers'  // namespace for the your default controller
        ],
   ],

from yii2-comments.

jsobers1331 avatar jsobers1331 commented on May 27, 2024

Thank you i got it to work i think.

from yii2-comments.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.