Search code examples
zend-frameworkzend-view

How to use a partial view from a different module in Zend?


I'm trying to access a partial view in foo from another module bar. Simplified file structure:

application/
    modules/
        foo/
            index.phtml
        bar/
            partial.phtml

And in index.html you would have the following code:

<?php echo $this->partialLoop('../bar/partial.phtml', $this->paginator);
echo $this->paginator; ?>

The problem is that you can't actually use parent traversal, as I get this error:

Requested scripts may not include parent directory traversal ("../", "..\" notation)

Is there any way to still include the partial view into my content page? (Or am I doing it wrong?) Thanks in advance.


Solution

  • You need to pass the module argument:

    <?php echo $this->partialLoop('partial.phtml', 'bar', $this->paginator); ?>