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
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).
#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.
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!!!
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?
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.
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.
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.
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…