Usergroups & Static Page Links

Hi!

I’m completely new to yii and still stumbling around in confusion…

I’m trying to create a footer link to a second contact form (similar to the default contact form) in my [color="#FF8C00"]themes/template/views/layouts/main.php[/color].

I copied the site/contact form from:

[color="#FF8C00"]protected/views/site/contact.php[/color]

to

[color="#FF8C00"]protected/views/site/contact2.php[/color]

But received a 404 error with the following url:


echo Yii::app()->createURL('site/contact2'); 

The system is unable to find the requested action "contact2".

I then moved the new page to:

[color="#FF8C00"]protected/views/site/pages/contact2.php[/color]

In my SiteController file, in the actions() function I have:


'page'=>array(

	'class'=>'CViewAction',

),



I tried the following:

[color="#FF8C00"]index.php?r=site/page&view=contact2[/color]

But got redirected back to ‘userGroups’.

I then tried:

[color="#FF8C00"]index.php/site/page/contact2[/color]

But received a ‘The requested view “index” was not found’ 404 error.

My urlManager in config/main.php has the following:


'urlManager'=>array(

	'urlFormat'=>'path',

	'rules'=>array(

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

		'page/<name>-<id:\d+>.html'=>'cms/node/page', 

),



I’ve had a look at these pages:

http://www.yiiframework.com/wiki/22/how-to-display-static-pages-in-yii/

http://www.yiiframework.com/wiki/48/by-example-chtml/

But I can only assume everything is being redirected through userGroups somehow and bypassing the standard rules.

Can anyone point me in the right direction?

Advice greatly appreciated :slight_smile:

Thanks!

Never mind, I’ve worked it out…

SiteController must have a function called:


	public function actionContact2()

	{

		$this->render('contact2',array());

	}	

	

In file "SiteController.php" you make will add new method "actionContact2"




public function actionContact2()

{

$this->render("contact2");

}