Blank application

Hi,

How do I create a blank application using Yii?

All the tutorials show how to create a "skeleton" app. But how do I create a blank application.

Please note, I still want the config files etc, just not the models, controllers etc.

Could you be more specific ?

Why do you need a blank application ?

Hi,

Yeah, the reason I want a blank application is because its just the way I prefer to work.

All of the tutorials on Yii so far have shown me how to create a skeleton app. However this comes with contact form, login, home page etc.

The code it generates is not really the style I like to write my code so, I would prefer if the application was just blank with no pre-made models / controllers.

I know the I could just create a skeleton app and delete the models and controllers, but Yii might have generated other files that are related to the model / controllers that need deleting that I do not know about.

So how do I create a blank application?

Obviously I still want the config files etc, so I can connect to the database but other than that I do not really the auto generated code, like models / controllers.

Any ideas?

I am surprised this is so difficult to answer, I would have thought the standard would have been a blank application, and then as an option you can get Yii to generate the skeleton rather than it being the other way around.

models, controllers, and views are just 3 dirs. You can easily generate a skeleton app following those instructions and just delete the contents of those dirs.

simply create a folder named whatever you wish

then create another folder and put the config file in it

all the rest is optional

dont forget that the config array must have an index like


'basePath'=>__DIR__.DIRECTORY_SEPARATOR.'..',

specifying where your application folder is in

then you’ll have to create the mvc folders by yourself, or just use Gii

I hope it clarify the things for you

Of course you will have to point the path to the config correcly in the index file

basically your index must have these 2 lines


require_once('path/to/library/yii.php');

Yii::createWebApplication('path/to/config/main.php')->run();

Cheers everyone,

I think I will just generate a skeleton app, and delete the model, controller, views files it generates. And start them from scratch. Thanks for your help everyone.

If anyone with more knowledge of Yii knows how to just create a blank app from the console I would love to hear it, but as of now I will just delete the files manually.

You may want to start with the Hello World app that comes with the Yii release. Copy the file structure to a directory of your choice. In index.php adjust the relative path to the Yii installation. Add a config directory, config file, e.g. main.php, add the config path to createWebApplication. Almost exactly as described above. You can use all relative paths dirname(FILE) and so on. Then you can move around the skeleton as you like. The default route is site/index so keep the SiteController.

/Tommy

What you think about a sandbox builder on the frontpage? Means you select basic things like application name, components to include in the config etc. and then you’re able to download that skeleton as zip. For now, such a starting-point doesn’t exist.

Personally, I’d like to start with a blank application as well.

Just a crazy little thought, probably because I’m in to the wine consumption part of my day.

What about create a basic application and then delete what you don’t want/need.

Just a thought, tomorrow I will be sober so we can continue with most of my brain functions, currently working with a subset.

doodle

I guess I should have paid better attention, it seems we came to the same conclusion.

:huh:

doddle