From 6166970074cad251dca4ef6e76f900c9af77f99a Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Fri, 24 May 2013 10:45:42 -0400 Subject: [PATCH 1/6] Added advanced composer.json. --- apps/advanced/composer.json | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 apps/advanced/composer.json diff --git a/apps/advanced/composer.json b/apps/advanced/composer.json new file mode 100644 index 0000000..824cf4d --- /dev/null +++ b/apps/advanced/composer.json @@ -0,0 +1,21 @@ +{ + "name": "yiisoft/yii2-app-advanced", + "description": "Yii 2 Advanced Application Template", + "keywords": ["yii", "framework", "advanced", "application template"], + "homepage": "http://www.yiiframework.com/", + "type": "project", + "license": "BSD-3-Clause", + "support": { + "issues": "https://github.com/yiisoft/yii2/issues?state=open", + "forum": "http://www.yiiframework.com/forum/", + "wiki": "http://www.yiiframework.com/wiki/", + "irc": "irc://irc.freenode.net/yii", + "source": "https://github.com/yiisoft/yii2" + }, + "minimum-stability": "dev", + "require": { + "php": ">=5.3.0", + "yiisoft/yii2": "dev-master", + "yiisoft/yii2-composer": "dev-master" + } +} From 595594ac8e5ade87cab6366aeaa15bd76ac81d87 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Fri, 24 May 2013 11:15:16 -0400 Subject: [PATCH 2/6] updated the guide doc. --- docs/guide/bootstrap.md | 89 ++++++++++++++++++++++++++----------------------- 1 file changed, 48 insertions(+), 41 deletions(-) diff --git a/docs/guide/bootstrap.md b/docs/guide/bootstrap.md index 47e3b8f..26a6bde 100644 --- a/docs/guide/bootstrap.md +++ b/docs/guide/bootstrap.md @@ -1,15 +1,30 @@ Bootstrap with Yii ================== -A ready-to-use Web application is distributed together with Yii. You may find -its source code under the `app` folder after you expand the Yii release file. -If you have installed Yii under a Web-accessible folder, you should be able to -access this application through the following URL: +Yii provides a few read-to-use application templates. Based on your needs, you may +choose one of them to bootstrap your project. + +In following, we describe how to get started with the "Yii 2 Basic Application Template". + + +### Install via Composer + +If you do not have [Composer](http://getcomposer.org/), you may download it from +[http://getcomposer.org/](http://getcomposer.org/) or run the following command on Linux/Unix/MacOS: ~~~ -http://localhost/yii/apps/bootstrap/index.php +curl -s http://getcomposer.org/installer | php ~~~ +You can then install the Bootstrap Application using the following command: + +~~~ +php composer.phar create-project --stability=dev yiisoft/yii2-app-basic yii-basic +~~~ + +Now you should be able to access the Bootstrap Application using the URL `http://localhost/yii-basic/www/`, +assuming `yii-basic` is directly under the document root of your Web server. + As you can see, the application has four pages: the homepage, the about page, the contact page and the login page. The contact page displays a contact @@ -20,42 +35,34 @@ and the login page allows users to be authenticated before accessing privileged The following diagram shows the directory structure of this application. ~~~ -app/ - index.php Web application entry script file - index-test.php entry script file for the functional tests - assets/ containing published resource files - css/ containing CSS files - img/ containing image files - themes/ containing application themes - protected/ containing protected application files - yii yii command line script for Unix/Linux - yii.bat yii command line script for Windows - commands/ containing customized yii console commands - components/ containing reusable user components - config/ containing configuration files - console.php the console application configuration - main.php the Web application configuration - controllers/ containing controller class files - SiteController.php the default controller class - data/ containing the sample database - schema.mysql.sql the DB schema for the sample MySQL database - schema.sqlite.sql the DB schema for the sample SQLite database - bootstrap.db the sample SQLite database file - vendor/ containing third-party extensions and libraries - messages/ containing translated messages - models/ containing model class files - User.php the User model - LoginForm.php the form model for 'login' action - ContactForm.php the form model for 'contact' action - runtime/ containing temporarily generated files - views/ containing controller view and layout files - layouts/ containing layout view files - main.php the base layout shared by all pages - site/ containing view files for the 'site' controller - about.php the view for the 'about' action - contact.php the view for the 'contact' action - index.php the view for the 'index' action - login.php the view for the 'login' action +yii-basic/ + yii yii command line script for Unix/Linux + yii.bat yii command line script for Windows + requirements.php the requirement checker script + commands/ containing customized yii console commands + config/ containing configuration files + console.php the console application configuration + main.php the Web application configuration + controllers/ containing controller class files + SiteController.php the default controller class + vendor/ containing third-party extensions and libraries + models/ containing model class files + User.php the User model + LoginForm.php the form model for 'login' action + ContactForm.php the form model for 'contact' action + runtime/ containing temporarily generated files + views/ containing controller view and layout files + layouts/ containing layout view files + main.php the base layout shared by all pages + site/ containing view files for the 'site' controller + about.php the view for the 'about' action + contact.php the view for the 'contact' action + index.php the view for the 'index' action + login.php the view for the 'login' action + www/ containing Web-accessible resources + index.php Web application entry script file + assets/ containing published resource files + css/ containing CSS files ~~~ From 2c0a3ca6baa5bbe2f1dcc4d0637b7430565288a5 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Fri, 24 May 2013 13:17:53 -0400 Subject: [PATCH 3/6] Added missing doc. --- framework/yii/widgets/Menu.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/framework/yii/widgets/Menu.php b/framework/yii/widgets/Menu.php index d63f202..08088d3 100644 --- a/framework/yii/widgets/Menu.php +++ b/framework/yii/widgets/Menu.php @@ -63,7 +63,8 @@ class Menu extends Widget * - template: string, optional, the template used to render the content of this menu item. * The token `{url}` will be replaced by the URL associated with this menu item, * and the token `{label}` will be replaced by the label of the menu item. - * If this option is not set, [[linkTemplate]] or [[labelTemplate]] will be used instead. + * If this option is not set, [[linkTemplate]] or [[labelTemplate]] will be used instead. + * - options: array, optional, the HTML attributes for the menu container tag. */ public $items = array(); /** @@ -163,7 +164,7 @@ class Menu extends Widget $n = count($items); $lines = array(); foreach ($items as $i => $item) { - $options = isset($item['itemOptions']) ? $item['itemOptions'] : array(); + $options = isset($item['options']) ? $item['options'] : array(); $class = array(); if ($item['active']) { $class[] = $this->activeCssClass; From 54eafd82945253bf5ae86de5daccf63a41f8e397 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Fri, 24 May 2013 19:00:58 +0400 Subject: [PATCH 4/6] Moved $params in basic application configs to the variable at the top so it can be reused for common component definitions if needed --- apps/basic/config/console.php | 4 ++-- apps/basic/config/main.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/basic/config/console.php b/apps/basic/config/console.php index df96023..bfb3ed7 100644 --- a/apps/basic/config/console.php +++ b/apps/basic/config/console.php @@ -1,5 +1,5 @@ 'bootstrap-console', 'basePath' => dirname(__DIR__), @@ -22,5 +22,5 @@ return array( ), ), ), - 'params' => require(__DIR__ . '/params.php'), + 'params' => $params, ); diff --git a/apps/basic/config/main.php b/apps/basic/config/main.php index b5980da..9adfba6 100644 --- a/apps/basic/config/main.php +++ b/apps/basic/config/main.php @@ -1,5 +1,5 @@ 'bootstrap', 'basePath' => dirname(__DIR__), @@ -34,5 +34,5 @@ return array( ), ), ), - 'params' => require(__DIR__ . '/params.php'), + 'params' => $params, ); From 4503067c08d775f0860c2715f723e671a0c57ad6 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Fri, 24 May 2013 19:12:30 +0400 Subject: [PATCH 5/6] Corrected basic application readme --- apps/basic/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/basic/README.md b/apps/basic/README.md index 47e5ca6..5300448 100644 --- a/apps/basic/README.md +++ b/apps/basic/README.md @@ -52,7 +52,7 @@ You can then install the Bootstrap Application using the following command: php composer.phar create-project --stability=dev yiisoft/yii2-app-basic yii-basic ~~~ -Now you should be able to access the Bootstrap Application using the URL `http://localhost/yii-basic/www/`, +Now you should be able to access the application using the URL `http://localhost/yii-basic/www/`, assuming `yii-basic` is directly under the document root of your Web server. From 93df0731a5e5e3e366f9ef983fe978195ee75dc1 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Fri, 24 May 2013 21:52:41 +0400 Subject: [PATCH 6/6] Application assets should not be ignored --- apps/basic/assets/.gitignore | 1 - apps/basic/assets/.gitkeep | 1 + apps/basic/runtime/.gitignore | 1 + apps/basic/vendor/.gitignore | 1 + apps/basic/www/assets/.gitignore | 1 + 5 files changed, 4 insertions(+), 1 deletion(-) delete mode 100644 apps/basic/assets/.gitignore create mode 100644 apps/basic/assets/.gitkeep diff --git a/apps/basic/assets/.gitignore b/apps/basic/assets/.gitignore deleted file mode 100644 index 72e8ffc..0000000 --- a/apps/basic/assets/.gitignore +++ /dev/null @@ -1 +0,0 @@ -* diff --git a/apps/basic/assets/.gitkeep b/apps/basic/assets/.gitkeep new file mode 100644 index 0000000..72e8ffc --- /dev/null +++ b/apps/basic/assets/.gitkeep @@ -0,0 +1 @@ +* diff --git a/apps/basic/runtime/.gitignore b/apps/basic/runtime/.gitignore index 72e8ffc..c96a04f 100644 --- a/apps/basic/runtime/.gitignore +++ b/apps/basic/runtime/.gitignore @@ -1 +1,2 @@ * +!.gitignore \ No newline at end of file diff --git a/apps/basic/vendor/.gitignore b/apps/basic/vendor/.gitignore index 72e8ffc..c96a04f 100644 --- a/apps/basic/vendor/.gitignore +++ b/apps/basic/vendor/.gitignore @@ -1 +1,2 @@ * +!.gitignore \ No newline at end of file diff --git a/apps/basic/www/assets/.gitignore b/apps/basic/www/assets/.gitignore index 72e8ffc..c96a04f 100644 --- a/apps/basic/www/assets/.gitignore +++ b/apps/basic/www/assets/.gitignore @@ -1 +1,2 @@ * +!.gitignore \ No newline at end of file