Why use plugins if this material can be hoped to be made with lithium :-)
I do not know Zend, but here is an example of how to configure the default paths for elements in different ways, so that they can be loaded from the linked view folder instead of the common path.
And add one more thing: we want to distinguish elements / partial from the normal view by adding un underscore to the file name (mimic Rails partials)
Migrate Media first during the boot process (config / bootstrap / media.php)
Media::type('default', null, array( 'view' => 'lithium\template\View', 'paths' => array( 'layout' => '{:library}/views/layouts/{:layout}.{:type}.php', 'template' => '{:library}/views/{:controller}/{:template}.{:type}.php', 'element' => array( '{:library}/views/{:controller}/_{:template}.{:type}.php', '{:library}/views/elements/{:template}.{:type}.php' ) ) ));
Then use
Suppose the controller is Documents
. Call to view:
<?= $this->_render('element', 'foo', $data, array('controller' => 'documents')); ?>
This will look for the file inside views/documents/_foo.html.php
, and if it does not exist, go back to /views/elements/foo.html.php
Such a simple rearrangement of the default values โโin the framework can be done in Lithium for a set of materials (default controller paths for creating namespaces, presentation paths, libraries, etc.)
Another example is to archive your template templates so that you can have things like pages/users_{username}.php
instead of the default lithium value: https://gist.github.com/1854561