Starting with Yii 2

Hi,

This is my very first day with Yii 2.0 after more than one year using 1.1.13

I would need some help to adjust…

1-Gii in Yii 2 does not generate a link to open a search form on a crud? What is the replacement for this?

2-In Yii 1.1 there used to be a folder named "messages" where to place translations for i18n. Where is it now? Is there an alternative way?

3-Documentation says: "In general, the files in the application can be divided into two types: those under basic/web and those under other directories. The former can be directly accessed via HTTP (i.e., in a browser), while the latter can not and should not be."

Because of this, and because protected folder no longer exists, what exactly do I put under public_html? only the basic/web folder? I dont understand what is the best strategy…

Thank you in advance.

  1. There are fields for filtering as the first gridview row.

  2. http://www.yiiframework.com/doc-2.0/guide-tutorial-i18n.html

  3. basic/web goes into public_html while everything else goes to the same level where public_html is.

Thank you samdark, but:

1-Those fields already existed in 1.1. What i’d like to know is about the link toopen the search form, which allows you to make more complex searches or search fields that are not on the grid.

2-Thank you. I’l check it out.

3-This seems to be a very messy organization. My folder struture has a lot of other stuff that doesn’t have to do with yii. Must I mix it all together in the same folder?..???

  1. Try specifying search model class when generating CRUD.

  2. You can create another directory to hold Yii app and then fix paths in index.php. The idea is that it’s not really a good idea to have your source code in web accessible directory.

Thank you samdark!!

I changed the path in index.php and all works fine.

For those with the same problem here is my directory structure:

-app_in (all stuff that comes with Yii (basic template) except web directory. no ‘basic’ dir, only stuff inside)

-public_html

-app (under public_html) (all files originally inside basic/web. not the directory itself. just the files in it.)

Now you need to modify index.php inside public_html\app to:

require(DIR . ‘/../../app_in/vendor/autoload.php’);

require(DIR . ‘/../../app_in/vendor/yiisoft/yii2/Yii.php’);

$config = require(DIR . ‘/../../app_in/config/web.php’);

It worked for me! My app has now the minimum stuff under the public folder.