Ctools content types- What do I need to do to get my content to render in the right place? I have some panels on my site.  Previously, I was using custom content panes with the PHP filter to call functions in a custom module.  The custom function had lots of print() statements and I simply dumped a bunch of HTML to the screen.

Now, I am trying to reform my bad programming practices by moving the custom content panes into Ctools content types.  I successfully created a content type, but when I call my function (in my custom module) full of print() statements, all of the HTML gets dumped to the top of the page, instead of where the content type has been placed within the panel.

Reading through articles online, it appears this is because the content pane expects me to return something it can render, not directly print() the HTML.  Is there another PHP function I can use to gather up all the HTML I was previously using print() for?  What is the correct way to output a bunch of HTML in a ctools content type?

(If this seems obvious, please bear with me.  I'm not a programmer by training and I'm probably in a bit over my head.)
From the top of my head you should simply be able to do:

$pane = new stdClass();
$pane-&gt;title = 'Check this out!'; // Optional
$pane-&gt;content = '&lt;div&gt;My content&lt;/div&gt;';
return $pane;


It's also worthwhile to review What are Ctools plugin (content type, access, etc), and how does one create them? which contains an example content type.

The question
Correct way to render a modules output through a template? shows an example of rendering through a template, so you can strip the markup out from your pane and have it contain only the relevant content.