yii2mod / yii2-cms

Simple CMS extension
MIT License
44 stars 24 forks source link

extension in advanced app #13

Closed thakkar-roshani closed 7 years ago

thakkar-roshani commented 7 years ago

Hi I am installing your extension in advanced app of yii. But i am getting error.

Can you please guide me how i can use it in advanced app? Please

ihorchepurnyi commented 7 years ago

Hi, try to the following steps 1 . php composer.phar require --prefer-dist yii2mod/yii2-cms "*"

  1. When extension has been installed, you need to setup the yii2mod-comments package
  2. When done, you need to add the following code to this config https://github.com/yiisoft/yii2-app-advanced/blob/master/backend/config/main.php
'id' => 'app-backend',
'controllerMap' => [
     'cms' => 'yii2mod\cms\controllers\CmsController',
],

Now you can access to management section through the following URL:

http://your-backend-site-url/cms/index

  1. When done, you need to add our custom page url class to urlManager section in your frontend config as follows:
    'components' => [
     'urlManager' => [
         'rules' => [
             ['class' => 'yii2mod\cms\components\PageUrlRule'], // custom page url class
         ]
     ],
    ],

5, And the last step, you need to add the following code to SiteController in fronted app folder

public function actions()
{
    return [
        'page' => [
            'class' => 'yii2mod\cms\actions\PageAction',
        ]
    ];
}

And now you can create your own pages via admin panel.

deep12650 commented 6 years ago

@igor-chepurnoi I am getting forbidden 403 Forbidden error after installation.

ihorchepurnyi commented 6 years ago

Hi, @deep12650

You need to create the user with admin role. Please, check this code - https://github.com/yii2mod/yii2-cms/blob/master/controllers/ManageController.php#L77

deep12650 commented 6 years ago

Thanks @igor-chepurnoi. I will do that.

zyber-envy commented 6 years ago

Hi @igor-chepurnoi , I need quick help on these:

  1. How do I set layout for only CMS Pages?
  2. How do I change default URL shown in create page, or on clicking view from index? Actually I am using Advance template, I created a page from backend but when I click on page view it redirect me with admin url, I want show frontend Url. Thanks,
pptyasar commented 5 years ago

I am not using RBAC, So how can I assign role? @igor-chepurnoi