new folder and namespace

May I create new folder in the advanced template?

I created a folder named "aaa" in the base path of advanced template.

and I add code as below

<?php

namespace frontend\controllers;

use aaa\t;


class HomeController extends \yii\web\Controller

{

    public function actionIndex()

    {

        $t = new t();

        $x = $t->getVar();

        return $this->render('index');

    }

}

when I use that class, the php show error "not found class"

<?php

namespace frontend\controllers;

use aaa\t;


class HomeController extends \yii\web\Controller

{

    public function actionIndex()

    {

        $t = new t();

        $x = $t->getVar();

        return $this->render('index');

    }

}

Question:

I added new model class file \frontend\models\xxxModel. it works anywhere if I write "use \frontend\models\xxxModel"

Why this does not work?

You should add alias ‘aaa’ in bootstrap like ‘frontend’/‘common’/‘backend’. Aliases used by Yii autoloading.

May I create new folder in the advanced template?

I created a folder named "aaa" in the base path of advanced template.

and I add code as below

<?php

namespace frontend\controllers;

use aaa\t;

class HomeController extends \yii\web\Controller

{

public function actionIndex()


{


    &#036;t = new t();


    &#036;x = &#036;t-&gt;getVar();


    return &#036;this-&gt;render('index');


}

}

when I use that class, the php show error "not found class"

<?php

namespace frontend\controllers;

use aaa\t;

class HomeController extends \yii\web\Controller

{

public function actionIndex()


{


    &#036;t = new t();


    &#036;x = &#036;t-&gt;getVar();


    return &#036;this-&gt;render('index');


}

}

Question:

I added new model class file \frontend\models\xxxModel. it works anywhere if I write "use \frontend\models\xxxModel"

Why this does not work?

I undersant you think about diffi

thank you very much. It works now.