문제

i am trying to render the view from module to project base view but it gives error.

I tried below combinations without any luck. It gives the error "DefaultController cannot find the requested view "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"=>""));

and tried with extensions too

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"=>""));

I am in "Forms" module and trying to render a file "protected/views/site/appsMenu.php". Plz help me..

도움이 되었습니까?

해결책

Use //:

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

This can be seen in the documentation

absolute view within the application: the view name starts with double slashes '//'. In this case, the view will be searched for under the application's view path. This syntax has been available since version 1.1.3.

다른 팁

This nasty little bit did the trick for me

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

Using // to alias to $root/protected/views and then putting that ../ bit in there to get me to $root/protected/views/../modules/$m/views/$c/$v which really means $root/protected/modules/$m/views/$c/$v

Of course, put reasonable values in for the $X and/or MyXXX values above.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top