yiiyii-modules

Yii - renderpartial from module to root folder


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..


Solution

  • 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.