CodeIgniter Forums
Redirecting Output Class to a File - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Redirecting Output Class to a File (/showthread.php?tid=26925)



Redirecting Output Class to a File - El Forum - 01-27-2010

[eluser]Eric Cope[/eluser]
I want to use the parser class and instead of outputting to the user, output to a file. Any ideas?


Redirecting Output Class to a File - El Forum - 01-27-2010

[eluser]cahva[/eluser]
Use the third parameter to return the parsed content. So something like this:
Code:
file_put_contents('filename',$this->parser->parse('some_template', $data, TRUE));



Redirecting Output Class to a File - El Forum - 01-27-2010

[eluser]Eric Cope[/eluser]
what about outputting views to a file?


Redirecting Output Class to a File - El Forum - 01-27-2010

[eluser]cahva[/eluser]
Man, read the docs! Smile

Code:
file_put_contents('filename',$this->load->view('some_view', $data, TRUE));



Redirecting Output Class to a File - El Forum - 01-27-2010

[eluser]Eric Cope[/eluser]
[quote author="cahva" date="1264627866"]Man, read the docs! Smile

Code:
file_put_contents('filename',$this->load->view('some_view', $data, TRUE));
[/quote]

You totally called me out... I and totally deserved it! Thanks :gulp: