Ways To Start A New Project

Do you guys always use the testdrive demo when creating a new project? Or is it possible to start completely from scratch? If so, what are the minimum required files? Testdrive creates lots of files and folders while some even empty, so I’m having a hard time traversing the directories.

Also, do you use Gii?

yes, use GII . create an app first then use gii to create models/controllers/views

yes, use GII . create an app first then use gii to create models/controllers/views

So when you guys start a new project you always have to start from the testdrive demo and then work on from there?

Since I’m still a newbie to Yii, I’m overwhelmed by the amount of files generated by the demo. Anyway, thanks. :)

the demo app generated using command-line sometimes confuse newcomers because it demonstrate a fairly amount of necessary features that Yii has.

any way the very basic yii application contains only 2 files (and one folder).

for very basic hello world application you need only 1 Controller and 1 action to handle the request, so do not use command line tool to generate the demo, but let us do this just by creating ‘myApplication’ folder under WEBROOT with the following structure:


- WEBROOT

  + framework //----> this is the main yii application folder

  - myApplication

      - controller

          SiteController.php

      index.php



index.php will be :




<?php

 $yii=dirname(__FILE__).'/../framework/yii.php';

 $config = array(

   'basePath'=>dirname(__FILE__),

  );


 require_once($yii);

 Yii::createWebApplication($config)->run();

?>



and the SiteController.php wil be :


<?php

class SiteController extends CController

{

 public function actionIndex()

 {

  echo "Hello World !!";

 }

}

?>

that is it !! then you can access your site: http://YOUR-DOMAIN/myApplication

Hello World !! should appear.

i hope this will help you and others whom may need this little tip for better understanding how Yii works.

for any other explaination dont hesitate to ask :)

Okay thank you! That’s exactly the answer I’m looking for. Anyway, I’m really having headaches because of the volume of files I need to work with.

deleted