Using the console, I generate a file sitemap.xml, all the logic of creating and generating a file is written in the controller. How to make a sitemap template (view) and then just in the middle to generate everything?

    1 answer 1

    You need to add the response format to the controller

    public function actionTest() { \Yii::$app->response->format = \yii\web\Response::FORMAT_XML; return $this->renderPartial('test'); } 

    If that read this .