Does anybody know how can I use the CGridView inside a yii console application(as widget function isn’t available here)?


I don’t know if I understand what you mean: You have a console application and want to use widgets in your console? Even if you would be able to create a widget in an console app (which to my knowledge isn’t possible because there is no CWidgetFactory class) how should a console be able to display complex HTML + javascript? Maybe I am horribly wrong but I never heard of something like that


I want to create the body of an email I send using the yii cron job(thus the console application). In the email body I want to include a table like the one CGRidView displays(I have the data provider and columns and I only need a "kind" of widget function to include the CGridView)

what about just creating the table for yourself?

echo '<table>';

foreach ($dataprovider->getData() as $data) {

echo '<tr>';

echo '<td>' . $data->firstname . '</td>';

echo '<td>' . $data->lastname . '</td>';

echo '</tr>'


echo '</table>';