D
D
des1roer2016-09-17 08:02:33
Yii
des1roer, 2016-09-17 08:02:33

Yii 2 doesn't see ash?

controller

<?php

namespace app\modules\myshop\controllers;

use app\modules\myshop\models\SignupForm;
use yii\web\Controller;

/**
 * Default controller for the `myshop` module
 */
class DefaultController extends Controller {

    /**
     * Renders the index view for the module
     * @return string
     */
    public function actionIndex() {
        return $this->render('index');
    }

    // Всплывшее модальное окно заполняем представлением signup.php формы с полями
    public function actionSignup() {
        $model = new SignupForm();
        //  $model = new \app\models\SignupForm();
        //$model->id =$userid;
        return $this->renderPartial('signup', [
                    'model' => $model,
        ]);
    }

// По нажатию в модальном окне на Отправить - форма отправляется администратору на почту     
    public function actionSubmitsignup() {
        $model = new SignupForm();
        $model->load(Yii::$app->request->post());

        if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) {

            //save the password
            $success = true;
            return json_encode($success);
        } else {
            return $this->renderPartial('signup', [
                        'model' => $model,
            ]);
        }
    }

}

structure
yFMzCf
'urlManager' => [
            'class' => 'yii\web\UrlManager',
            // Disable index.php
            'showScriptName' => false,
            // Disable r= routes
            'enablePrettyUrl' => true,
            'rules' => array(
                '<controller:\w+>/<id:\d+>' => '<controller>/view',
                '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
                '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
            //    'signup' => '/myshop/default/signup',
            //    'submitsignup' => '/myshop/submitsignup',
            ),
        ],

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2016-09-17
@des1roer

Try the following

'<_m:[\w\-]+>' => '<_m>/default/index',
 '<_m:[\w\-]+>/<_c:[\w\-]+>' => '<_m>/<_c>/index',
 '<_m:[\w\-]+>/<_c:[\w\-]+>/<_a:[\w\-]+>' => '<_m>/<_c>/<_a>',
 '<_m:[\w\-]+>/<_c:[\w\-]+>/<id:\d+>' => '<_m>/<_c>/view',
 '<_m:[\w\-]+>/<_c:[\w\-]+>/<id:\d+>/<_a:[\w\-]+>' => '<_m>/<_c>/<_a>',

Add after the ground rules.
Start from the first line, see the action of the module, then continue.
It may be necessary to edit the links in the navigation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question