[eluser]Rok Biderman[/eluser]
While I agree that n0xie has a point, here is a way to do it.
Code:
function write_to_file()
{
$this->load->helper('file');
$this->load->model('yourmodelname');
$data['example'] = $this->yourmodelname->yourmethodname();
$datatofile = $this->load->view('someview', $data, TRUE);
if ( ! write_file('./static/somefilename.htm', $datatofile))
{echo 'Unable to write the file';}
else
{echo 'File written!';}
}
As you see, you can pass a view into a variable with 3rd argument set to true. Then it's easy to put whatever you want into the view, kinda like this.
Code:
<html>
<head>
<title>Sometitle</title>
</head>
<body>
<?php
echo $example->id . "<br>\n";
echo $example->firstname . "<br>\n";
echo $example->lastname . "<br>\n";
echo $example->adress . "<br>\n";
echo $example->phone1 . "<br>\n";
echo $example->phone2 . "<br>\n";
echo $example->city . "<br>\n";
?>
</body>
</html>
I did this because I couldn't find it in forums and I think it could come in hand once in a while. For let's say a blog that's expected to have heavy traffic, this would be benefitial. However I see a lot of new users trying to extend the classes and use the framework in very unusual ways, before they even got a regular crud working, many times trying to incorporate bad (since past good habits are not problematic) habits they acquired in the past. That way, CI will soon become another nightmare for them. Just my 2c.