This won't do what I want, because $this->load->view() doesn't immediately echo the view it loads, so the 2 echoed lines will appear at the top of the file that ultimately gets generated:

<div class='main'></div><html>...

So is there a way to do what I want, essentially "echo" snippets of HTML inline within the controller and have them appear in the same place relative to the views loaded above and below them? Obviously I could accomplish this by making entire view files for <div class='main'> and </div>, but this seems a little silly.

I think it's a completely reasonable thing to want to do :) Anyway, your last line indirectly led me to the answer, which is to use $this->output->append_output() in place of echo.
–
Tom CrockettJul 15 '11 at 21:58