Domanda

I've managed to create several forms using YII and GII, but I'll be honest, I don't understand it perfectly. If anyone can explain this to me, I'd really appreciate it.

Basically, I create accessed the form creator here:

index.php/gii/form

I then filled in:

Model Class: Product
View Name: createProduct
View Path: application.views (default)
Scenario: createProduct

When I generate the code, I end up with a file called "createProduct.php" located at:

protected\views\createProduct.php
  1. How do I access this view? I figured something like this should work: http://mysite.com/createProduct (but it doesn't)
  2. What do I do if I want to change the link to be: http://mysite.com/admin/products/createProduct

Any help would be greatly appreciated!

È stato utile?

Soluzione

  1. Gii tells you to modify your controller. It shows the code you should insert after generating process. When you do this you'll be able to access your form by http://yoursite.com/controller/action

  2. You can manage your urls using UrlManager. Look this article in docs - http://www.yiiframework.com/doc/guide/1.1/en/topics.url

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top