mailer improvement (minor)

Aloha,

This is my first post on the forum so I guess a hello to the community is warranted. I’m a Web Developer for a University here in paradise and have developed several Symfony powered web applications in the past. Based on my recommendation, we will be using Yii from now on only because Symfony is much harder for junior programmers to grasp and is also to some degree bloated in my mind. It’s a great framework, but Yii certainly looks light weight and still very powerful.

I had to submit a first post in order to add this suggestion to the extension I have modified.

The EMailer has a getView method that will set a body and layout to an email message. Most of the emails I’m sending are HTML so I added an html parameter to it as shown below. Please let me know if this can be done in a simpler way.

I’m glad to be part of the community :rolleyes:




public function getView($view, $vars = array(), $layout = null, $html=true)

   {

      $body = Yii::app()->controller->renderPartial($this->pathViews.'.'.$view, array_merge($vars, array('content'=>$this->_myMailer)), true);

      if ($layout === null) {

      	if($html){

         	$this->_myMailer->MsgHtml($body);

      	}else{

      		$this->_myMailer->Body = $body;

      	}

      }

      else {

      	if($html){

         	$this->_myMailer->MsgHtml(Yii::app()->controller->renderPartial($this->pathLayouts.'.'.$layout, array('content'=>$body), true));

      	}else{

      		$this->_myMailer->Body = Yii::app()->controller->renderPartial($this->pathLayouts.'.'.$layout, array('content'=>$body), true);

      	}

      }

   }