zig
zig

Reputation: 1

Setting Home Page In yii Application With Default Controller And Default Action ?

hello I'm trying to change de default controller of my yii application. I found multiple answers online but all of them are requiring to change this function in the main.php but I cannot find such function to modify. here is the function

return array(
    'name' => 'Web Application',
    'defaultController' => 'HomePages ', 

);

When I put this function right bellow the first return array as such the page disappears:

<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
    'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
    'name'=>'HomePages',

    return array(
    'name' => 'Web Application',
    'defaultController' => 'HomePages ', 

);


    // preloading 'log' component
    'preload'=>array('log'),

    // autoloading model and component classes
    'import'=>array(
        'application.models.*',
        'application.components.*',
    ),

I cannot find such thing as "core defaults controller (site/index)" how can I do this correctly?

Upvotes: 0

Views: 737

Answers (1)

user3410843
user3410843

Reputation: 205

you should only put the values in Yii return array, not 2 return arrays in the same thing

return array(
    'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
    'name'=>'HomePages',
    'defaultController' => 'HomePages', 
);

And make sure that you delete that extra space after HomePages word and have controller named HomePages

Upvotes: 1

Related Questions