1

I'm using Zend Framework 2 (v2.1.4) and I have a partials template that I want to use in several Modules. According to the documentation I can access partials in other Modules, but

That said, it’s likely a better practice to put re-usable partials in shared view script paths.

This sounds like a good idea, but I can't find any documentation on this "share view script path". Where do I find it, and when I've set it, how do I tell the partial() helper to use them?

4

1 回答 1

3

在你的 module.config.php

'view_manager' => array(
        'template_path_stack' => array(
            'mymodule' => __DIR__ . '/../view',
        ),
        'template_map' => array(
            'snippets/mypartial' => __DIR__ . '/../view/snippets/mypartial.phtml',
        ),
    ),

并像那样使用

<?php echo $this->partial("snippets/mypartial"); ?>
于 2013-04-18T08:33:59.220 回答