default view

Hi,

I created a simple database table for storing content. With gii I generated the necessary files (controller and views (CRUD)).

Now I would like to have my Yii website so, that it will get this view as default page when the website is requested with no parameters (homepage).

The files which are created are:

controllers/ContentController.php

models/Content.php

views/content/_form.php

views/content/_search.php

views/content/_view.php

views/content/admin.php

views/content/create.php

views/content/index.php

views/content/update.php

views/content/view.php

I’m not sure if I want to display the index.php or the view.php with an id.

On the chat and on this website I found out it should be done in the urlManager settings, but I didn’t get it working. This are my settings now:




		'urlManager'=>array(

			'urlFormat'=>'path',

           		 'showScriptName'=>false,

           		 'caseSensitive'=>false,

			 'urlSuffix'=>'.html',

          		  'useStrictParsing'=>false, // this needs to be set on false for gii access

			 'rules'=>array(

			    ''=>array(

		       		// gii rules

			    	'gii'=>'gii',

	            		'gii/<controller:\w+>'=>'gii/<controller>',

	           		'gii/<controller:\w+>/<action:\w+>'=>'gii/<controller>/<action>',

				

				// Other website rules

			   	'site/index', 'urlSuffix'=>'',

			    	'site/page/<view:\w+>'=>'site/page',

				'<controller:\w+>/<id:\d+>'=>'<controller>/view',

				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',

				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>'),

			),

		),



I tried adding this line (after searching and tips from the chat)




''=>'controller/content',



But that didn’t help.

Can someone help me with this? So I can have the content list (index view) or one content (view view) on the main page?

Try this





'urlManager'=>array(

	'urlFormat' => 'path',

 	'showScriptName' => false,

 	'caseSensitive' => false,

 	'urlSuffix' => '.html',

 	'useStrictParsing' => false, // this needs to be set on false for gii access

 	'rules' => array(

    	'<controller:\w+>/<id:\d+>'=>'<controller>/view',

    	'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',

    	'<controller:\w+>/<action:\w+>'=>'<controller>/<action>'

 	),

),




Maybe




''=>'content/index',