After creating a module using YIIC it gives the following message:
Now, where exactly is the "application configuration" ?
After creating a module using YIIC it gives the following message:
Now, where exactly is the "application configuration" ?
Found it!
/protected/config/main.php
Added for my admin module:
'modules'=>array('admin'),
Ok… moving on further
Accessing my new admin module in my browser no problem:
http://localhost/yii/index.php?r=admin
Ok, so lets create a model and CRUD in admin for my "labels" table in the database:
>> model admin.Labels
generate models/Labels.php
generate fixtures/Labels.php
generate unit/LabelsTest.php
The following model classes are successfully generated:
Labels
If you have a 'db' database connection, you can test these models now with:
$model=Labels::model()->find();
print_r($model);
So far so good, next:
>> crud admin.Labels
generate LabelsController.php
generate LabelsTest.php
mkdir C:/wamp/www/yii/protected/modules/admin/views/labels
generate create.php
generate update.php
generate list.php
generate show.php
generate admin.php
generate _form.php
Crud 'labels' has been successfully created. You may access it via:
http://hostname/path/to/index.php?r=admin/labels
So, lets see if we can access admin/labels at: http://localhost/yii/index.php?r=admin/labels
OOPS:
PHP Error
Description
include(Labels.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory
I am using yesterday’s SVN. Is this a bug, or have I done something wrong?
You need to make sure you have imported the models directory that contains the Labels class.
Ok, great!
For the benefit of others, in /protected/config/main.php:
// autoloading model and component classes
'import'=>array(
'application.models.*',
'application.components.*',
'application.modules.admin.*', // added this line
),