renderPartial in extensions

I see that widgets have good view rendering support, but I found that I can not render views inside of my extension (I'm creating an email extension).  This was the only way I could render a view:

Yii::app()->controller->renderPartial(…)

But the problem is that is will only look for views in the 'application.views' directory, not in application.components.views as I would like and seems to make more sense

The reason I want my email extension (or would you call it a component? should it extend CApplicationComponent as it does now?) to render a view is that the extension can be put into a 'debug' mode, in which the extension outputs the email to the layout (so I would like to take use of a view) instead of actually emailing it.

I would also like the extension to support using views as the email content, and even layouts, as CakePHP does.

How to define your email extension depends on how you would use this extension.

You can always use CController::renderViewFile() to render a view file if you find render() or renderPartial() doesn't fulfill your needs.

I think we probably can allow using path alias to specify a view. For example, Yii::app()->controller->render('@application.extensions.email.views.registration') would translate to rendering the view file 'protected/extensions/email/views/registration.php'.

To make the path alias shorter, a new alias can be defined by using render(). For example,

Yii::setPathOfAlias('email', dirname(FILE).'/views');

assuming FILE gives the class file path of your email extension.

Then we can use Yii::app()->controller->render('@email.registration');

What do you think?

Ok thanks for the tips.  I'll release the extension soon

Instead of using the @ symbol, would it instead be possible for Yii to auto-detect if the string uses aliases? (eg if the string contains periods?)

Yeah, let's go this way.