How to get renderPartial to work inside a portlet

I’m trying to get create an accordion side bar using CJuiAccordion. I’ve created a portlet which queries and returns the data using a view file. That is just fine. However when I try and add in the CJuiAccordion to the view, then have the html content returned from a partial view I get:

I’m sure this is an easy answer. I’m just so new…


I’d like to know how to do this too. I’ve encountered exactly the same problem when creating a widget. I have a small view I reuse on other views, through renderPartial and want to reuse the small view in a widget - but as ptoly’s pointed out, renderPartial is not part of CPortlet.

I thought about creating some sort of fake interface that extends CController, and having my widgets implement that, but I thought there must be an easier way…

Thanks in advance.

Did you try ($yourwidget)->controller->renderPartial() ?

(not tested)


Thank you! That has worked perfectly. I had to be specific in the location of the view, so I changed the view name from “MyContentView” to “/Content/MyContentView” to give it’s relative path, and it worked first time.


Try just doing $this->render, when inside a portlet, you don’t need to use renderPartial because all renders are partial. Then you have access to your other views within the same location as the component. Helps keep things organized, and you don’t have to fully qualify the location to your partial views.

In my case I needed to give the path to the view file in the ‘alias’ form, but after doing so everything works perfectly! Thanks!