Skip to content

Commit

Permalink
Merge branch '@Xerkus:feature/controller-to-template' and Close zendf…
Browse files Browse the repository at this point in the history
  • Loading branch information
malukenho committed Oct 14, 2014
2 parents b7bcd85 + 6e54eee commit 2b97f82
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/languages/en/modules/zend.mvc.quick-start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,37 @@ That's it. Save the file.

.. _zend.mvc.quick-start.create-a-route:

View scripts for module names with subnamespaces
------------------------------------------------

As per PSR-0, module should be named following this rule: ``\<Vendor Name>\(<Namespace>\)*``
Default controller class to template mapping does not work very well with those: it will remove subnamespace.

To address that issue new mapping was introduced since 2.3.0. To maintain backwards compatibility that
mapping is not enabled by default. To enable it, you need to add your module namespace to whitelist in your module config:

.. code-block:: php
:linenos:
'view_manager' => array(
// Controller namespace to template map
// or whitelisting for controller FQCN to template mapping
'controller_map' => array(
'<Module\Name>' => true,
),
),
Now, create the directory ``view/<module>/<name>/hello``. Inside that directory, create a file named ``world.phtml``.
Inside that, paste in the following:

.. code-block:: php
:linenos:
<h1>Greetings!</h1>
<p>You said "<?php echo $this->escapeHtml($message) ?>".</p>
Create a Route
--------------

Expand Down
5 changes: 5 additions & 0 deletions docs/languages/en/modules/zend.mvc.services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,11 @@ local configuration file overrides the global configuration.
// Default suffix to use when resolving template scripts, if none, 'phtml' is used
'default_template_suffix' => $templateSuffix, // e.g. 'php'
// Controller namespace to template map
// or whitelisting for controller FQCN to template mapping
'controller_map' => array(
),
// Layout template name
'layout' => $layoutTemplateName, // e.g. 'layout/layout'
Expand Down

0 comments on commit 2b97f82

Please sign in to comment.