4

我正在尝试将视图从模块渲染到项目基础视图,但它给出了错误。

我尝试了以下组合,但没有任何运气。它给出了错误“DefaultController 找不到请求的视图“appsMenu”。”

echo $this->renderPartial("appsMenu",array("moduleName"=>""),true, true);
echo $this->renderPartial("//appsMenu",array("moduleName"=>""));
echo $this->renderPartial("views/site/appsMenu",array("moduleName"=>""));
echo $this->renderPartial("views/site/appsMenu",array("moduleName"=>""));
echo $this->renderPartial("/appsMenu",array("moduleName"=>""));
echo $this->renderPartial("protected/views/site/appsMenu",array("moduleName"=>""));
echo $this->renderPartial("/protected/views/site/appsMenu",array("moduleName"=>""));
echo $this->renderPartial("views/appsMenu",array("moduleName"=>""));
echo $this->renderPartial("/views/appsMenu",array("moduleName"=>""));
echo $this->renderPartial("site/views/appsMenu",array("moduleName"=>""));
echo $this->renderPartial("site/views/appsMenu",array("moduleName"=>""));
echo $this->renderPartial("site/appsMenu",array("moduleName"=>""));
echo $this->renderPartial("protected/views/site/appsMenu",array("moduleName"=>""));
echo $this->renderPartial("//protected/views/site/appsMenu",array("moduleName"=>""));

并尝试过扩展

echo $this->renderPartial("appsMenu.php",array("moduleName"=>""),true, true);
echo $this->renderPartial("//appsMenu.php",array("moduleName"=>""));
echo $this->renderPartial("views/site/appsMenu.php",array("moduleName"=>""));
echo $this->renderPartial("views/site/appsMenu.php",array("moduleName"=>""));
echo $this->renderPartial("/appsMenu.php",array("moduleName"=>""));
echo $this->renderPartial("protected/views/site/appsMenu.php",array("moduleName"=>""));
echo $this->renderPartial("/protected/views/site/appsMenu.php",array("moduleName"=>""));
echo $this->renderPartial("views/appsMenu.php",array("moduleName"=>""));
echo $this->renderPartial("/views/appsMenu.php",array("moduleName"=>""));
echo $this->renderPartial("site/views/appsMenu.php",array("moduleName"=>""));
echo $this->renderPartial("site/views/appsMenu.php",array("moduleName"=>""));
echo $this->renderPartial("site/appsMenu.php",array("moduleName"=>""));
echo $this->renderPartial("protected/views/site/appsMenu.php",array("moduleName"=>""));
echo $this->renderPartial("//protected/views/site/appsMenu.php",array("moduleName"=>""));

我在“表单”模块中并尝试呈现文件“protected/views/site/appsMenu.php”。请帮帮我..

4

2 回答 2

10

使用//

$this->renderPartial("//site/appsMenu");

这可以在文档中看到

应用程序中的绝对视图:视图名称以双斜杠“//”开头。在这种情况下,将在应用程序的视图路径下搜索视图。此语法从 1.1.3 版开始可用。

于 2013-01-25T15:54:53.677 回答
2

这个讨厌的一点点对我有用

$this->renderPartial('//../modules/MyMod/views/MyCon/MyView');

使用//别名$root/protected/views,然后把那个../位放在那里让我明白$root/protected/views/../modules/$m/views/$c/$v这真的意味着$root/protected/modules/$m/views/$c/$v

当然,为上面的 $X 和/或 MyXXX 值输入合理的值。

于 2014-01-10T23:00:31.537 回答