简体   繁体   中英

how to view backend crud from frontend yii2 advanced folder

I am using yii2 advanced app. and in frontend I am using tabsx widget from which I want to open backend\\view\\companies\\index.php.

Is it possible to do so and how?

here is code frontend\\views\\contacts\\index.php

echo TabsX::widget([
    'position' => TabsX::POS_ABOVE,
    'align' => TabsX::ALIGN_LEFT,
    'items' => [
        [
            'label' => 'gridview',
            'content' => $content_grid,//**want backend\view\companies\index.php page to open here... how to do it.. **
            'active' => true
        ],
        [
            'label' => 'Basic Search',
            'content' => $content_basic_search,
            'headerOptions' => ['style'=>'font-weight:bold'],
            'options' => ['id' => 'myveryownID'],
        ],
        [
            'label' => 'Dropdown',
            'items' => [
                 [
                     'label' => 'DropdownA',
                     'content' => 'DropdownA, Anim pariatur cliche...',
                 ],
                 [
                     'label' => 'DropdownB',
                     'content' => 'DropdownB, Anim pariatur cliche...',
                 ],
            ],
        ],
    ],
]);

how to get that?

您是否尝试过使用linkOptions?

'linkOptions'=>['data-url'=>\yii\helpers\Url::to(['backend/view/companies/index'])]

I don't use this widget before, but I think, it will help:

  1. Add a BackendUrlManager in config (common/config/main.php):

     'components' => [ 'urlManagerBackend' => [ 'baseUrl' => 'http://backend.myproject.com', //Here you need to insert your backend app link 'class'=>'yii\\web\\UrlManager', 'enablePrettyUrl' => true, 'showScriptName' => false, ], ... ] 
  2. Use a link

     'linkOptions'=>['data-url'=>Yii::$app->urlManagerBackend->createAbsoluteUrl(['backend/view/companies/index'])])] 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM