Browse Source

Merge branch 'master'

Conflicts:
	apps/advanced/composer.json
tags/2.0.0-beta
Alexander Makarov 12 years ago
parent
commit
e82881ba7f
  1. 6
      apps/advanced/composer.json
  2. 2
      apps/basic/README.md
  3. 0
      apps/basic/assets/.gitkeep
  4. 4
      apps/basic/config/console.php
  5. 4
      apps/basic/config/main.php
  6. 1
      apps/basic/runtime/.gitignore
  7. 1
      apps/basic/vendor/.gitignore
  8. 1
      apps/basic/www/assets/.gitignore
  9. 89
      docs/guide/bootstrap.md
  10. 3
      framework/yii/widgets/Menu.php

6
apps/advanced/composer.json

@ -1,7 +1,7 @@
{ {
"name": "yiisoft/yii2-app-basic", "name": "yiisoft/yii2-app-advanced",
"description": "Yii 2 Basic Application Template", "description": "Yii 2 Advanced Application Template",
"keywords": ["yii", "framework", "basic", "application template"], "keywords": ["yii", "framework", "advanced", "application template"],
"homepage": "http://www.yiiframework.com/", "homepage": "http://www.yiiframework.com/",
"type": "project", "type": "project",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",

2
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 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. assuming `yii-basic` is directly under the document root of your Web server.

0
apps/basic/assets/.gitignore → apps/basic/assets/.gitkeep

4
apps/basic/config/console.php

@ -1,5 +1,5 @@
<?php <?php
$params = require(__DIR__ . '/params.php');
return array( return array(
'id' => 'bootstrap-console', 'id' => 'bootstrap-console',
'basePath' => dirname(__DIR__), 'basePath' => dirname(__DIR__),
@ -22,5 +22,5 @@ return array(
), ),
), ),
), ),
'params' => require(__DIR__ . '/params.php'), 'params' => $params,
); );

4
apps/basic/config/main.php

@ -1,5 +1,5 @@
<?php <?php
$params = require(__DIR__ . '/params.php');
return array( return array(
'id' => 'bootstrap', 'id' => 'bootstrap',
'basePath' => dirname(__DIR__), 'basePath' => dirname(__DIR__),
@ -34,5 +34,5 @@ return array(
), ),
), ),
), ),
'params' => require(__DIR__ . '/params.php'), 'params' => $params,
); );

1
apps/basic/runtime/.gitignore vendored

@ -1 +1,2 @@
* *
!.gitignore

1
apps/basic/vendor/.gitignore vendored

@ -1 +1,2 @@
* *
!.gitignore

1
apps/basic/www/assets/.gitignore vendored

@ -1 +1,2 @@
* *
!.gitignore

89
docs/guide/bootstrap.md

@ -1,15 +1,30 @@
Bootstrap with Yii Bootstrap with Yii
================== ==================
A ready-to-use Web application is distributed together with Yii. You may find Yii provides a few read-to-use application templates. Based on your needs, you may
its source code under the `app` folder after you expand the Yii release file. choose one of them to bootstrap your project.
If you have installed Yii under a Web-accessible folder, you should be able to
access this application through the following URL: 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, 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 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. The following diagram shows the directory structure of this application.
~~~ ~~~
app/ yii-basic/
index.php Web application entry script file yii yii command line script for Unix/Linux
index-test.php entry script file for the functional tests yii.bat yii command line script for Windows
assets/ containing published resource files requirements.php the requirement checker script
css/ containing CSS files commands/ containing customized yii console commands
img/ containing image files config/ containing configuration files
themes/ containing application themes console.php the console application configuration
protected/ containing protected application files main.php the Web application configuration
yii yii command line script for Unix/Linux controllers/ containing controller class files
yii.bat yii command line script for Windows SiteController.php the default controller class
commands/ containing customized yii console commands vendor/ containing third-party extensions and libraries
components/ containing reusable user components models/ containing model class files
config/ containing configuration files User.php the User model
console.php the console application configuration LoginForm.php the form model for 'login' action
main.php the Web application configuration ContactForm.php the form model for 'contact' action
controllers/ containing controller class files runtime/ containing temporarily generated files
SiteController.php the default controller class views/ containing controller view and layout files
data/ containing the sample database layouts/ containing layout view files
schema.mysql.sql the DB schema for the sample MySQL database main.php the base layout shared by all pages
schema.sqlite.sql the DB schema for the sample SQLite database site/ containing view files for the 'site' controller
bootstrap.db the sample SQLite database file about.php the view for the 'about' action
vendor/ containing third-party extensions and libraries contact.php the view for the 'contact' action
messages/ containing translated messages index.php the view for the 'index' action
models/ containing model class files login.php the view for the 'login' action
User.php the User model www/ containing Web-accessible resources
LoginForm.php the form model for 'login' action index.php Web application entry script file
ContactForm.php the form model for 'contact' action assets/ containing published resource files
runtime/ containing temporarily generated files css/ containing CSS 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
~~~ ~~~

3
framework/yii/widgets/Menu.php

@ -64,6 +64,7 @@ class Menu extends Widget
* The token `{url}` will be replaced by the URL associated with 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. * 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(); public $items = array();
/** /**
@ -163,7 +164,7 @@ class Menu extends Widget
$n = count($items); $n = count($items);
$lines = array(); $lines = array();
foreach ($items as $i => $item) { foreach ($items as $i => $item) {
$options = isset($item['itemOptions']) ? $item['itemOptions'] : array(); $options = isset($item['options']) ? $item['options'] : array();
$class = array(); $class = array();
if ($item['active']) { if ($item['active']) {
$class[] = $this->activeCssClass; $class[] = $this->activeCssClass;

Loading…
Cancel
Save