Skip to content
This repository has been archived by the owner on May 24, 2018. It is now read-only.

Initial mentioning of controller_map feature #1298

Merged
merged 2 commits into from
Oct 16, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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