Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
[Docs] Fixes #59 - Check Documentation Code Blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
froschdesign committed Feb 13, 2016
1 parent eed620c commit 49714a2
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 87 deletions.
78 changes: 41 additions & 37 deletions doc/book/zend.mvc.intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,22 @@ sending the response.

The basic application structure follows:

application_root/
config/
application.config.php
autoload/
global.php
local.php
// etc.
data/
module/
vendor/
public/
.htaccess
index.php
init_autoloader.php
```
application_root/
config/
application.config.php
autoload/
global.php
local.php
// etc.
data/
module/
vendor/
public/
.htaccess
index.php
init_autoloader.php
```

The `public/index.php` marshalls all user requests to your website, retrieving an array of
configuration located in `config/application.config.php`. On return, it `run()`s the `Application`,
Expand Down Expand Up @@ -84,29 +86,31 @@ of tasks.

The recommended module structure follows:

module_root<named-after-module-namespace>/
Module.php
autoload_classmap.php
autoload_function.php
autoload_register.php
config/
module.config.php
public/
images/
css/
js/
src/
<module_namespace>/
<code files>
test/
phpunit.xml
bootstrap.php
<module_namespace>/
<test code files>
view/
<dir-named-after-module-namespace>/
<dir-named-after-a-controller>/
<.phtml files>
```
module_root<named-after-module-namespace>/
Module.php
autoload_classmap.php
autoload_function.php
autoload_register.php
config/
module.config.php
public/
images/
css/
js/
src/
<module_namespace>/
<code files>
test/
phpunit.xml
bootstrap.php
<module_namespace>/
<test code files>
view/
<dir-named-after-module-namespace>/
<dir-named-after-a-controller>/
<.phtml files>
```

Since a module acts as a namespace, the module root directory should be that namespace. This
namespace could also include a vendor prefix of sorts. As an example a module centered around "User"
Expand Down
78 changes: 39 additions & 39 deletions doc/book/zend.mvc.quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ be done in the following ways.

Simply clone the `ZendSkeletonApplication` repository:

```php
```bash
prompt> git clone git://github.com/zendframework/ZendSkeletonApplication.git my-application
```

Then run [Composer](http://getcomposer.org/)'s `install` command to install the ZF library and any
other configured dependencies:

```php
```bash
prompt> php ./composer.phar install
```

Expand All @@ -28,7 +28,7 @@ prompt> php ./composer.phar install
Simply clone the `ZendSkeletonApplication` repository, using the `--recursive` option, which will
also grab ZF.

```php
```bash
prompt> git clone --recursive git://github.com/zendframework/ZendSkeletonApplication.git
my-application
```
Expand Down Expand Up @@ -249,47 +249,47 @@ your module. Replace &lt;module-name&gt; with the name of your module.
```php
// module.config.php
return array(
'<module-name' = array(
'type' = 'Literal',
'options' = array(
'route' = '/<module-name',
'defaults' = array(
'controller' = '<module-namespace\Controller\Index',
'action' = 'index',
),
),
'may_terminate' = true,
'child_routes' = array(
'default' = array(
'type' = 'Segment',
'options' = array(
'route' = '/[:controller[/:action]]',
'constraints' = array(
'controller' = '[a-zA-Z][a-zA-Z0-9_-]*',
'action' = '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' = array(
),
),
),
),
),
// ... other configuration ...
'<module-name>' => array(
'type' => 'Literal',
'options' => array(
'route' => '/<module-name>',
'defaults' => array(
'controller' => '<module-namespace>\Controller\Index',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'default' => array(
'type' => 'Segment',
'options' => array(
'route' => '/[:controller[/:action]]',
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
),
),
),
),
),
// ... other configuration ...
);
```

Additionally, we need to tell the application we have a controller:

> ```php
```php
// module.config.php
return array(
'controllers' = array(
'invokables' = array(
'<module-namespace\Controller\Index' = '<module-namespace\Controller\IndexController',
// Do similar for each other controller in your module
),
),
// ... other configuration ...
'controllers' => array(
'invokables' => array(
'<module-namespace>\Controller\Index' => '<module-namespace>\Controller\IndexController',
// Do similar for each other controller in your module
),
),
// ... other configuration ...
);
```

Expand Down Expand Up @@ -365,15 +365,15 @@ ZendSkeletonApplication.
Now alter the location in your URL to append the path "/hello/world", and load the page. You should
now get the following content:

```php
```html
<h1>Greetings!</h1>

<p>You said "foo".</p>
```

Now alter the location to append "?message=bar" and load the page. You should now get:

```php
```html
<h1>Greetings!</h1>

<p>You said "bar".</p>
Expand Down
22 changes: 11 additions & 11 deletions doc/book/zend.mvc.routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,18 +325,18 @@ In the above example, the `$routePlugins` is an instance of `Zend\Mvc\Router\Rou
```php
$routePlugins = new Zend\Mvc\Router\RoutePluginManager();
$plugins = array(
'hostname' = 'Zend\Mvc\Router\Http\Hostname',
'literal' = 'Zend\Mvc\Router\Http\Literal',
'part' = 'Zend\Mvc\Router\Http\Part',
'regex' = 'Zend\Mvc\Router\Http\Regex',
'scheme' = 'Zend\Mvc\Router\Http\Scheme',
'segment' = 'Zend\Mvc\Router\Http\Segment',
'wildcard' = 'Zend\Mvc\Router\Http\Wildcard',
'query' = 'Zend\Mvc\Router\Http\Query',
'method' = 'Zend\Mvc\Router\Http\Method',
'hostname' => 'Zend\Mvc\Router\Http\Hostname',
'literal' => 'Zend\Mvc\Router\Http\Literal',
'part' => 'Zend\Mvc\Router\Http\Part',
'regex' => 'Zend\Mvc\Router\Http\Regex',
'scheme' => 'Zend\Mvc\Router\Http\Scheme',
'segment' => 'Zend\Mvc\Router\Http\Segment',
'wildcard' => 'Zend\Mvc\Router\Http\Wildcard',
'query' => 'Zend\Mvc\Router\Http\Query',
'method' => 'Zend\Mvc\Router\Http\Method',
);
foreach ($plugins as $name = $class) {
$routePlugins-setInvokableClass($name, $class);
foreach ($plugins as $name => $class) {
$routePlugins->setInvokableClass($name, $class);
}
```
When using `Zend\Mvc\Router\Http\TreeRouteStack`, the `RoutePluginManager` is set up by default, and
Expand Down

0 comments on commit 49714a2

Please sign in to comment.