symfony - clean variables before sending to template

Posted by topdog 530 days ago Questions| csv template file All

Hi!

On the project I am currently working, I had created an action that generates a csv file.

Here is some of my current template codem, which generated the csv file on-the-fly:

<?php header('Content-Disposition: attachment; filename="file_'.date("Y-m-d_H-i",time()) .'.csv"'); ?>
Branch:;<?php echo $branch; ?>;

The variable $branch, needs some formatting to be displayed on the csv file. For now, all the cleaning/formatting work is being done on the action itself but I do know it is not the most adequate place.

Should I create a private auxiliary function on the file that contains the action or it is recommended a more suitable place?

Note that I would like to avoid to perform the cleaning/formatting work on the template because some is quite extensive.

Thanks in advance for the help, Best regards!

Originally asked by: Rui Gonçalves on Stack Overflow

Discuss Bury


Who Voted for this Question