Reputation: 736
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.
Upvotes: 10
Views: 10124
Reputation: 3907
I have gone through the same issue. I had to include views from one module into another module's views. I have solved the issue by adding the script path within the controller of the view (in which I had to include the other view)
$this->view->addScriptPath(APPLICATION_PATH.'/modules/moduleName/views/scripts/actionName');
and then included the script within the view file:
<?php
echo $this->render('common-header.phtml');
//Name of the file you want to include
?>
Upvotes: 7
Reputation: 60413
You need to pass the module argument:
<?php echo $this->partialLoop('partial.phtml', 'bar', $this->paginator); ?>
Upvotes: 17