Need HELP in understanding how to install

Hello everyone – i am new to yii – hopefully with your help i can learn it well

here are my questions:

#1 - all instructions give step to install in a local personal computer

Is that what it is meant to be? to install in a local pc first then upload applications created to a web server? OR can it be all done on a real web server?

I uploaded the extracted files to my web host account (linux shared server)

therefore …

#2 - since i extracted and uploaded yii to a shared webhost

how can I use the yiic  command line script?

when I surf to

mysite.com/yii/framework/yiic.php 

I get a 404 error permission denied

There are no instructions to chmd 777 any folders or files in the installation instruction

i really want to get into this software

but too many hours to install and use because install instructions are not fully clear (it assumes that user is always installing in a local computer).

PLEASE HELP

#1 The normal procedure is that you first install Yii on your local development machine which you should have full control of; you develop your web app on your development machine; and finally you upload your work to the public server.

#2 yiic.php is not meant to be accessed via browser. It is a command line script. You should open a console window on your local development machine and call the needed yiic commands.

you explained it very clear

but …

WHY is this very important fact "not" included in the installation instructions?

#1 - it would have saved me hours of headache

#2 - it would of retained others who may have also been confused in this

However …

I do thank you for your kind (and very fast) reply

i appreciated it

THANKS

ps: I wil never understand why this is not in the instructions

wow

Well, to me the instructions are very clear, at least the install and yiic instructions.

Read the guide more carefully.

I don't want to rag on you too, but I understood the instructions and the local part / webserver part. I'm getting slowed down futher into the instructions, because I've never had formal training in PHP at all much less MVC. I'm a Java programmer who was well, taught bad form. And so I'm trying to get grips on all this and it's slow going for me, but don't give up! This looks like one of the most rewarding frameworks to learn out there.

AND MY Props to the instruction guys, more vids is ALWAYS welcome!!!

It seems I don't understand install instructions. I have problem with First Yii Application, with yiic. Look:

[table]

[tr]

[td]D:\wamp\www\yii-1.0.6.r1102\framework>yiic webapp WebRoot\testdrive

'php.exe' is not recognized as an internal or external command,

operable program or batch file.[/td]

[/tr]

[/table]

What is wrong?

Check this: http://www.yiiframew…doc/cookbook/3/

I solved the problem. Thanks qiang.

So is there no way to install Yii without using the command line script?

For example, could I perhaps download a .ZIP file that contains the directory structure I’ll need for my website?

Cheers!

What do you mean?

Yes, of course.

It’s pure PHP - so just go ahead.

I usually run the yiic tool on my development machine to get a skeleton - then upload by FTP to my live site.

So I tried that. I ran the command line tool to get the skeleton (why I have to run a tool is beyond me), but never the less, I deleted all the files within the skeleton except the config/main.php and the index.php, but now the application yells at me (error here, error there).

Where can I find a list of “required” files in the skeleton but forgoing the actual “web app” that is created. I don’t need the web app at all. Does that make sense?

To be totally frank with you:

No, it does not make any sense.

Do yourself a big favor and use the generated skeleton without deleting any folders or files.

At least until you have a solid understand of how MVC - and Yii - works.

Read the Yii definitive guide, please. :)

The tool generates a skeleton application, complete with directories and initial files, so you need to run it at least once, as Yii doesn’t feature a skeleton app for you to copy.

After that, do what you please: either generate new ones, or copy and edit. That’s up to you.

But do not make the assumption that you can get by with just index.php and protected/config/main.php is just silly.

Let me try to more clearly explain my issue & please correct me if I am wrong in any of my assumptions.

Running the command YiiRoot/framework/yiic webapp WebRoot/testdrive generates a skeleton application inside of my webroot, yes?

What files can I delete to "remove" the application generated, leaving me only with the required Yii files that I need to create my OWN application?

I assume the file "protected/config/main.php" is a file I should NOT delete, and I assume the file "protected/views/site/contact.php" is a file I COULD delete.

Basically, how can I strip away the demo application leaving only a blank white PHP page.

If my request doesn’t make sense, then forgive my ignorance in how your Yii framework is supposed to work, and I will be on my way to another framework.

Thank you kindly in advance.

Basically (what was wrong with your previous account??) you can delete everything in protected/controllers, protected/models and everything in protected/views, except protected/views/layouts.

Just take a look at what’s there.

You can probably figure out what can be removed.

Do not remove any directories.

My point is that you need to understand what’s there and why it’s there.

Once you do, you know what you can remove.

I really don’t care if you choose another framework or not.

That’s entirely up to you.

I just have a hunch that you’ll enjoy Yii. ;)

Because I am bored (I have some programming I need to do and thus need an excuse not doing it) I will walk you through the process.

First, create a skeleton


yiic webapp testingapp

First, go into protected/views/site and remove the ‘pages’ subdirectory.

Second, go into protected/models and delete ‘ContactForm.php’.

If you don’t need any testing, you can delete index-test.php, protected/config/test.php and the directory protected/tests.

Leave the rest be.

Now, edit protected/controllers/SiteController.php, so that it looks like this:


<?php


class SiteController extends Controller

{

	/**

	 * This is the default 'index' action that is invoked

	 * when an action is not explicitly requested by users.

	 */

	public function actionIndex()

	{

		// renders the view file 'protected/views/site/index.php'

		// using the default layout 'protected/views/layouts/main.php'

		$this->render('index');

	}


	/**

	 * This is the action to handle external exceptions.

	 */

	public function actionError()

	{

		if($error=Yii::app()->errorHandler->error)

		{

			if(Yii::app()->request->isAjaxRequest)

				echo $error['message'];

			else

	    		$this->render('error', $error);

		}

	}


	/**

	 * Displays the login page

	 */

	public function actionLogin()

	{

		$model=new LoginForm;


		// if it is ajax validation request

		if(isset($_POST['ajax']) && $_POST['ajax']==='login-form')

		{

			echo CActiveForm::validate($model);

			Yii::app()->end();

		}


		// collect user input data

		if(isset($_POST['LoginForm']))

		{

			$model->attributes=$_POST['LoginForm'];

			// validate user input and redirect to the previous page if valid

			if($model->validate() && $model->login())

				$this->redirect(Yii::app()->user->returnUrl);

		}

		// display the login form

		$this->render('login',array('model'=>$model));

	}


	/**

	 * Logs out the current user and redirect to homepage.

	 */

	public function actionLogout()

	{

		Yii::app()->user->logout();

		$this->redirect(Yii::app()->homeUrl);

	}

}

You removed the contact error and the page-related actions.

Last bit:

Edit protected/views/site/index.php:

Delete everything in the file and save it.

Now you should get a blank page.

I forgot that you also need to edit [i]protected/views/layouts/main.php:

[/i]


	<div id="mainmenu">

		<?php $this->widget('zii.widgets.CMenu',array(

			'items'=>array(

				array('label'=>'Home', 'url'=>array('/site/index')),

				array('label'=>'Login', 'url'=>array('/site/login'), 'visible'=>Yii::app()->user->isGuest),

				array('label'=>'Logout ('.Yii::app()->user->name.')', 'url'=>array('/site/logout'), 'visible'=>!Yii::app()->user->isGuest)

			),

		)); ?>

	</div><!-- mainmenu -->



[i]

[/i]Just remove Contact and About from the menu.

That’s it.

To customize the rest, read the guide.

You next question will probably be:

Do I need to do this s**t each time I generate an application using yiic?

No.

What I’ve done is create my own WebApp command, called MiniApp.

Simply go into yii/framework/cli/command, copy WebApp.php to MiniApp.php, and edit the file: change the class name, the author, etc.

And change whatever else you need to change in it, especially line number 62:


			$sourceDir=realpath(dirname(__FILE__).'/../views/miniapp');

I call my custom template ‘miniapp’.

Next, copy yii/framework/cli/views/webapp to yii/framework/cli/views/miniapp, and do all your deletes and edits.

Test your custom yiic command:


yiic miniapp myminiapp

That’s one way to generate exactly what you want to generate.

Thank you for your reply. It’s exactly what I was looking for. And the reason I made another account is that there is a limitation of 3 posts on the first day your account was created. It also makes you wait 10 minutes after making an account before allowing you to post AND you can’t post links. Not sure if all of that is intended, but it sure as heck makes it hard for new members to ask questions they can’t seem to find the answer for. Anyhoo…

Yes, this is intended to prevent forum spamming…

The first day you can post only 3 messages and messages are checked for links and stop words… but after that there are no more any restriction…