So this is my project directory structure:
application/
layouts/
scripts/
default.phtml
partials/
partial.phtml
modules/
default/
controllers/
models/
forms/
views/
scripts/
public/
In the default.phtml layotu I'm trying to include a partial like this:
<?php echo $this->partial('partials/partial.phtml', array()); ?>
Which is getting me this error:
script 'partials/partial.phtml' not found in path (...)
Does that mean partials can开发者_如何学Python be included only from within view scripts? I could put the partial inside modules/default/views directory but that seems wrong because in case there are more modules the same partial file would repeat itself multiple times.
partials will be loaded from the views/scripts directory not from the layouts/scripts directory also when beeing called from the layout viewscriopt.
if you really need to have your partials in the layout folder you need to configure a new view object with the scriptPath pointing to your layouts/scripts dir. instead you can maybe find an existing view object in the layout internals which already has this path set.
then simply call the partial viewhelper on this view object.
精彩评论