Yii Framework Forum: [solved] yi-user installation problem - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[solved] yi-user installation problem Rate Topic: -----

#1 User is offline   Marco W. 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 46
  • Joined: 29-October 10
  • Location:Hamburg, Germany

Posted 02 November 2010 - 02:16 AM

Hi guys,

i have setup the yi-user extension as described. Now i am getting an error:
Call to a member function t() on a non-object in D:\dev\ciprojects\oya_yii\protected\views\layouts\main.php on line 36

// main.php line 36 ff:
array('url'=>Yii::app()->getModule('user')->loginUrl, 'label'=>Yii::app()->getModule('user')->t("Login"), 'visible'=>Yii::app()->user->isGuest),
array('url'=>Yii::app()->getModule('user')->registrationUrl, 'label'=>Yii::app()->getModule('user')->t("Register"), 'visible'=>Yii::app()->user->isGuest),
array('url'=>Yii::app()->getModule('user')->profileUrl, 'label'=>Yii::app()->getModule('user')->t("Profile"), 'visible'=>!Yii::app()->user->isGuest),
array('url'=>Yii::app()->getModule('user')->logoutUrl, 'label'=>Yii::app()->getModule('user')->t("Logout").' ('.Yii::app()->user->name.')', 'visible'=>!Yii::app()->user->isGuest),

I tried hardcoding the labels, but the 'url' is also not working. So it seems to me the module is not loaded correctly.
My config:
<?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' => 'Testpage - powered by Yii',

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

		// autoloading model and component classes
		'import' => array(
				'application.models.*',
				'application.components.*',
				'application.modules.user.models.*',
				'application.modules.user.components.*',
		),
		
		'modules' => array(
				// uncomment the following to enable the Gii tool

				'gii' => array(
						'class' => 'system.gii.GiiModule',
						'password' => 'admin',
				),

				'modules' => array(
						'user',
				),
		),

		// application components
		'components' => array(
				'user' => array(
						// enable cookie-based authentication
						'allowAutoLogin' => true,
						'loginUrl' => array('/user/login'),
				),
				// uncomment the following to enable URLs in path-format

				'urlManager' => array(
						'urlFormat' => 'path',
						'rules' => array(
								'<controller:\w+>/<id:\d+>' => '<controller>/view',
								'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
								'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
						),
				),
				// uncomment the following to use a MySQL database

				'db' => array(
						'connectionString' => 'mysql:host=localhost;dbname=oya_yii',
						'emulatePrepare' => true,
						'username' => 'root',
						'password' => 'root',
						'charset' => 'utf8',
				),
				'errorHandler' => array(
						// use 'site/error' action to display errors
						'errorAction' => 'site/error',
				),
				'log' => array(
						'class' => 'CLogRouter',
						'routes' => array(
								array(
										'class' => 'CFileLogRoute',
										'levels' => 'error, warning',
								),
								// uncomment the following to show log messages on web pages

								array(
										'class' => 'CWebLogRoute',
								),
						),
				),
		),
		// application-level parameters that can be accessed
		// using Yii::app()->params['paramName']
		'params' => array(
				// this is used in contact page
				'adminEmail' => 'webmaster@example.com',
		),
);


I have searched for the topic and had a look at the yii-user wiki but could not find anything.
Probably i missed something very easy / stupid, as this is my first try using yii :)
Can you give me some hints, please?

TIA,
Marco
0

#2 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 02 November 2010 - 03:15 AM

I can see what's wrong:
                                'modules' => array(
                                                'user',
                                ),

You have a 'modules' array inside of a modules array. :)
If you move the 'user' entry out of it and into the main 'modules' array, it should work.
"Less noise - more signal"
0

#3 User is offline   Marco W. 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 46
  • Joined: 29-October 10
  • Location:Hamburg, Germany

Posted 02 November 2010 - 03:24 AM

View Postjacmoe, on 02 November 2010 - 03:15 AM, said:

I can see what's wrong:
                                'modules' => array(
                                                'user',
                                ),

You have a 'modules' array inside of a modules array. :)
If you move the 'user' entry out of it and into the main 'modules' array, it should work.


Thank you so much, of course it works now.

Marco
0

#4 User is offline   Marco W. 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 46
  • Joined: 29-October 10
  • Location:Hamburg, Germany

Posted 02 November 2010 - 03:28 AM

How to mark this thread as solved? i cannot edit the thread name. Marco
0

#5 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 02 November 2010 - 07:17 AM

I think you can change the title of the topic by editing the first post. :)
You need to switch to using Full Editor, though.
"Less noise - more signal"
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users