Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
a25f8700
Commit
a25f8700
authored
Feb 20, 2013
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renamed create -> webapp/create, specified global options
parent
63cb47e1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
80 additions
and
7 deletions
+80
-7
Application.php
framework/console/Application.php
+1
-1
WebappController.php
framework/console/controllers/WebappController.php
+15
-5
config.php
framework/console/webapp/config.php
+1
-1
index.php
framework/console/webapp/default/index.php
+11
-0
main.php
framework/console/webapp/default/protected/config/main.php
+17
-0
SiteController.php
...e/webapp/default/protected/controllers/SiteController.php
+16
-0
main.php
...k/console/webapp/default/protected/views/layouts/main.php
+17
-0
index.php
...ork/console/webapp/default/protected/views/site/index.php
+2
-0
No files found.
framework/console/Application.php
View file @
a25f8700
...
@@ -126,7 +126,7 @@ class Application extends \yii\base\Application
...
@@ -126,7 +126,7 @@ class Application extends \yii\base\Application
'message'
=>
'yii\console\controllers\MessageController'
,
'message'
=>
'yii\console\controllers\MessageController'
,
'help'
=>
'yii\console\controllers\HelpController'
,
'help'
=>
'yii\console\controllers\HelpController'
,
'migrate'
=>
'yii\console\controllers\MigrateController'
,
'migrate'
=>
'yii\console\controllers\MigrateController'
,
'
app'
=>
'yii\console\controllers\Create
Controller'
,
'
webapp'
=>
'yii\console\controllers\Webapp
Controller'
,
'cache'
=>
'yii\console\controllers\CacheController'
,
'cache'
=>
'yii\console\controllers\CacheController'
,
);
);
}
}
...
...
framework/console/controllers/
Create
Controller.php
→
framework/console/controllers/
Webapp
Controller.php
View file @
a25f8700
<?php
<?php
/**
/**
*
Create
Controller class file.
*
Webapp
Controller class file.
*
*
* @link http://www.yiiframework.com/
* @link http://www.yiiframework.com/
* @copyright Copyright © 2008 Yii Software LLC
* @copyright Copyright © 2008 Yii Software LLC
...
@@ -20,14 +20,14 @@ use yii\base\Exception;
...
@@ -20,14 +20,14 @@ use yii\base\Exception;
* @author Alexander Makarov <sam@rmcreative.ru>
* @author Alexander Makarov <sam@rmcreative.ru>
* @since 2.0
* @since 2.0
*/
*/
class
Create
Controller
extends
Controller
class
Webapp
Controller
extends
Controller
{
{
private
$_rootPath
;
private
$_rootPath
;
private
$_config
;
private
$_config
;
/**
/**
* @var string custom template path. If specified, templates will be
* @var string custom template path. If specified, templates will be
* searched there additionally to `framework/console/
create
`.
* searched there additionally to `framework/console/
webapp
`.
*/
*/
public
$templatesPath
;
public
$templatesPath
;
...
@@ -46,6 +46,16 @@ class CreateController extends Controller
...
@@ -46,6 +46,16 @@ class CreateController extends Controller
}
}
}
}
public
function
globalOptions
()
{
return
array
(
'templatesPath'
,
'type'
);
}
public
function
actionIndex
()
{
$this
->
forward
(
'help/index'
,
array
(
'-args'
=>
array
(
'webapp/create'
)));
}
/**
/**
* Generates Yii application at the path specified via appPath parameter.
* Generates Yii application at the path specified via appPath parameter.
*
*
...
@@ -56,7 +66,7 @@ class CreateController extends Controller
...
@@ -56,7 +66,7 @@ class CreateController extends Controller
* @throws \yii\base\Exception if path specified is not valid
* @throws \yii\base\Exception if path specified is not valid
* @return integer the exit status
* @return integer the exit status
*/
*/
public
function
action
Index
(
$path
)
public
function
action
Create
(
$path
)
{
{
$path
=
strtr
(
$path
,
'/\\'
,
DIRECTORY_SEPARATOR
);
$path
=
strtr
(
$path
,
'/\\'
,
DIRECTORY_SEPARATOR
);
if
(
strpos
(
$path
,
DIRECTORY_SEPARATOR
)
===
false
)
{
if
(
strpos
(
$path
,
DIRECTORY_SEPARATOR
)
===
false
)
{
...
@@ -127,7 +137,7 @@ class CreateController extends Controller
...
@@ -127,7 +137,7 @@ class CreateController extends Controller
*/
*/
protected
function
getDefaultTemplatesPath
()
protected
function
getDefaultTemplatesPath
()
{
{
return
realpath
(
__DIR__
.
'/../
create
'
);
return
realpath
(
__DIR__
.
'/../
webapp
'
);
}
}
/**
/**
...
...
framework/console/
create
/config.php
→
framework/console/
webapp
/config.php
View file @
a25f8700
<?php
<?php
/** @var $controller \yii\console\controllers\
Create
Controller */
/** @var $controller \yii\console\controllers\
Webapp
Controller */
$controller
=
$this
;
$controller
=
$this
;
return
array
(
return
array
(
...
...
framework/console/webapp/default/index.php
0 → 100644
View file @
a25f8700
<?php
define
(
'YII_DEBUG'
,
true
);
$yii
=
__DIR__
.
'/../framework/yii.php'
;
require
$yii
;
$config
=
require
dirname
(
__DIR__
)
.
'/protected/config/main.php'
;
$basePath
=
dirname
(
__DIR__
)
.
'/protected'
;
$app
=
new
\yii\web\Application
(
'webapp'
,
$basePath
,
$config
);
$app
->
run
();
\ No newline at end of file
framework/console/webapp/default/protected/config/main.php
0 → 100644
View file @
a25f8700
<?php
return
array
(
'name'
=>
'My Web Application'
,
'components'
=>
array
(
// uncomment the following to use a MySQL database
/*
'db' => array(
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=testdrive',
'username' => 'root',
'password' => '',
),
*/
),
);
\ No newline at end of file
framework/console/webapp/default/protected/controllers/SiteController.php
0 → 100644
View file @
a25f8700
<?php
use
\yii\web\Controller
;
/**
* SiteController
*/
class
SiteController
extends
Controller
{
public
function
actionIndex
()
{
echo
$this
->
render
(
'index'
,
array
(
'name'
=>
'Qiang'
,
));
}
}
\ No newline at end of file
framework/console/webapp/default/protected/views/layouts/main.php
0 → 100644
View file @
a25f8700
<!doctype html>
<html
lang=
"en"
>
<head>
<meta
charset=
"utf-8"
/>
<title>
<?php
echo
$this
->
context
->
pageTitle
?>
</title>
</head>
<body>
<h1>
<?php
echo
$this
->
context
->
pageTitle
?>
</h1>
<div
class=
"content"
>
<?php
echo
$content
?>
</div>
<div
class=
"footer"
>
<?php
echo
\Yii
::
powered
()
?>
</div>
</body>
</html>
\ No newline at end of file
framework/console/webapp/default/protected/views/site/index.php
0 → 100644
View file @
a25f8700
Hello,
<?php
echo
$name
?>
!
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment