Creating the controller

Hello,

I need to create the controller of my application using the yiic shell. To start the shell, i need to navigate to the root of my demo application by running the following command: C:\>cd easyphp\www\demo then i need to execute yiic with the following shell command: %YiiRoot/framework/yiic shell. i don’t know what to write in my command line to execute the last command properly. However when try c:\easyphp\www\demo>c:\easyphp\www\demo\protected\yiic shell i get the following:

<!DOCTYPE html PUBLIC

    &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;


    &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<title>

PHP Error</title>

<style type="text/css">

/<![CDATA[/

body {font-family:"Verdana";font-weight:normal;color:black;background-color:whit

e;}

h1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }

h2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }

h3 {font-family:"Verdana";font-weight:bold;font-size:11pt}

p {font-family:"Verdana";font-size:9pt;}

pre {font-family:"Lucida Console";font-size:10pt;}

.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}

.message {color: maroon;}

.source {font-family:"Lucida Console";font-weight:normal;background-color:#ffffe

e;}

.error {background-color: #ffeeee;}

/]]>/

</style>

</head>

<body>

<h1>PHP Error</h1>

<h3>Description</h3>

<p class="message">

date(): It is not safe to rely on the system’s timezone settings. You are *

required* to use the date.timezone setting or the date_default_timezone_set() fu

nction. In case you used any of those methods and you are still getting this war

ning, you most likely misspelled the timezone identifier. We selected 'Asia

/Dubai’ for ‘4.0/no DST’ instead</p>

<h3>Source File</h3>

<p>

C:\easyphp\www\demo\protected\views\layouts\main.php(47)</p>

<div class="source">

<pre>

00035: array(‘label’=&gt;‘Logout (’.Yii::app

()-&gt;user-&gt;name.’)’, ‘url’=&gt;array(’/site/logout

'), ‘visible’=&gt;!Yii::app()-&gt;user-&gt;isGuest)

00036: ),

00037: )); ?&gt;

00038: &lt;/div&gt;&lt;!-- mainmenu --&gt;

00039:

00040: &lt;?php $this-&gt;widget(‘zii.widgets.CBreadcrumbs’, array

(

00041: ‘links’=&gt;$this-&gt;breadcrumbs,

00042: )); ?&gt;&lt;!-- breadcrumbs --&gt;

00043:

00044: &lt;?php echo $content; ?&gt;

00045:

00046: &lt;div id=&quot;footer&quot;&gt;

<div class=“error”>00047: Copyright &amp;copy; &lt;?php echo date(’

Y’); ?&gt; by My Company.&lt;br/&gt;

</div>00048: All Rights Reserved.&lt;br/&gt;

00049: &lt;?php echo Yii::powered(); ?&gt;

00050: &lt;/div&gt;&lt;!-- footer --&gt;

00051:

00052: &lt;/div&gt;&lt;!-- page --&gt;

00053:

00054: &lt;/body&gt;

00055: &lt;/html&gt;</pre>

</div><!-- end of source -->

<h3>Stack Trace</h3>

<div class="callstack">

<pre>

#0 C:\easyphp\www\demo\protected\views\layouts\main.php(47): date()

#1 C:\easyphp\www\yii\framework\web\CBaseController.php(119): require()

#2 C:\easyphp\www\yii\framework\web\CBaseController.php(88): SiteController-&gt;

renderInternal()

#3 C:\easyphp\www\yii\framework\web\widgets\CContentDecorator.php(78): SiteContr

oller-&gt;renderFile()

#4 C:\easyphp\www\yii\framework\web\widgets\CContentDecorator.php(56): CContentD

ecorator-&gt;decorate()

#5 C:\easyphp\www\yii\framework\web\widgets\COutputProcessor.php(45): CContentDe

corator-&gt;processOutput()

#6 C:\easyphp\www\yii\framework\web\CBaseController.php(199): CContentDecorator-

&gt;run()

#7 C:\easyphp\www\yii\framework\web\CBaseController.php(294): SiteController-&gt

;endWidget()

#8 C:\easyphp\www\demo\protected\views\layouts\column1.php(7): SiteController-&g

t;endContent()

#9 C:\easyphp\www\yii\framework\web\CBaseController.php(119): require()

#10 C:\easyphp\www\yii\framework\web\CBaseController.php(88): SiteController-&gt

;renderInternal()

#11 C:\easyphp\www\yii\framework\web\CController.php(748): SiteController-&gt;re

nderFile()

#12 C:\easyphp\www\demo\protected\controllers\SiteController.php(32): SiteContro

ller-&gt;render()

#13 C:\easyphp\www\yii\framework\web\actions\CInlineAction.php(57): SiteControll

er-&gt;actionIndex()

#14 C:\easyphp\www\yii\framework\web\CController.php(300): CInlineAction-&gt;run

()

#15 C:\easyphp\www\yii\framework\web\CController.php(278): SiteController-&gt;ru

nAction()

#16 C:\easyphp\www\yii\framework\web\CController.php(257): SiteController-&gt;ru

nActionWithFilters()

#17 C:\easyphp\www\yii\framework\web\CWebApplication.php(324): SiteController-&g

t;run()

#18 C:\easyphp\www\yii\framework\web\CWebApplication.php(121): CWebApplication-&

gt;runController()

#19 C:\easyphp\www\yii\framework\base\CApplication.php(135): CWebApplication-&gt

;processRequest()

#20 C:\easyphp\www\demo\index.php(13): CWebApplication-&gt;run()

#21 C:\easyphp\www\yii\framework\cli\commands\ShellCommand.php(78): require()

#22 C:\easyphp\www\yii\framework\console\CConsoleCommandRunner.php(62): ShellCom

mand-&gt;run()

#23 C:\easyphp\www\yii\framework\console\CConsoleApplication.php(88): CConsoleCo

mmandRunner-&gt;run()

#24 C:\easyphp\www\yii\framework\base\CApplication.php(135): CConsoleApplication

-&gt;processRequest()

#25 C:\easyphp\www\yii\framework\yiic.php(33): CConsoleApplication-&gt;run()

#26 C:\easyphp\www\demo\protected\yiic.php(7): require_once()

</pre>

</div><!-- end of callstack -->

<div class="version">

Warning: date(): It is not safe to rely on the system’s timezone settings. You a

re required to use the date.timezone setting or the date_default_timezone_set(

) function. In case you used any of those methods and you are still getting this

warning, you most likely misspelled the timezone identifier. We selected 'Asia/

Dubai’ for ‘4.0/no DST’ instead in C:\easyphp\www\yii\framework\views\exception.

php on line 71

2010-12-07 22:24:39 <a href="http://www.yiiframework.com/">Yii Framework</a>/1.1

.5</div>

</body>

</html>

But this is not what i want!!!

The required response should be as follows:

Yii Interactive Tool v1.1

Please type ‘help’ for help. Type ‘exit’ to quit.

Any1 can tell me how can i get the required response????

I’m using easyphp5.3.2 and yii1.1.5

You have to set the default timezone: http://php.net/manual/en/function.date-default-timezone-set.php

Also look here: http://www.yiiframework.com/doc/api/1.1/CApplication#setTimeZone-detail

But better to do it in the php.ini.

Also try Gii. It’s a more advanced tool :)

Thanx for the help Andy, i’m now using gii. IT’s much easier this way. The book i’m using uses yiic tool. Didn’t know about gii before.

Wich book are you using?

I’m using "Agile Web Application Development with Yii1.1 and PHP5 ".

The book does mention Gii, but starts out with the yiic tool.

Probably because the yiic tool is the one used to create a new webapp, whereas Gii can’t do that for the obvious reasons (catch 22).