sensorario, on 13 April 2013 - 10:07 AM, said:
I suggest you another way. For example you can create your own component:
class YourComponent
{
public static function yourMethod()
{
echo "hello!";
}
}
And call it from each methods you need:
class MyExampleController extends Controller
{
public function actionShowMe()
{
YourComponent::yourMethod();
}
}
class GoCommand extends CConsoleCommand
{
public function run($args)
{
YourComponent::yourMethod();
}
}
Thanks for the suggestion. It help but in my case I use mpdf extension and I need to renderPartial for my dataProvider. How can I do it?
public static function send()
{
......
$officer = new CArrayDataProvider($tmpOfficer, array(
'pagination'=>array(
'pageSize'=>count($tmpOfficer),
),
));
$mPDF1 = Yii::app()->ePdf->mpdf();
$mPDF1 = Yii::app()->ePdf->mpdf('en-x','A4-L');
$stylesheet = file_get_contents(Yii::getPathOfAlias('webroot') . '\..\css\screen.css');
$mPDF1->WriteHTML($stylesheet, 1);
$mPDF1->WriteHTML($this->renderPartial('blastEmail2',array(
'dataProvider'=>$officer,
'title'=>"<b>" . $alarm->name . "</b><br/>" . $alarm->alert_day,
'email'=>$to,
), true));
...............
}
I can't use $this->renderPartial. How to do it?