I have a custom module that generates a page of output, my question is about how to add html elements to the output such as headings and paragraphs etc.
My module is as follows
function mymodule_page() {
$output .= '<h3>'.t('Installs '.$cell).'</h3>';
$output .= theme('flot_graph', $graph1);
return $output;
}
is this the correct way to do this?
should line two be like this instead?
$output .= t('<h3>Installs '.$cell.'</h3>');
I prefer do not mix logic and presentation in module files, so I would use a tpl to print the content. For example, in your module I would put this code:
function mymodule_page() {
return theme_render_template(drupal_get_path('theme', 'your_theme') . 'path/to/your/file.tpl', array('cell' => $cell, 'graph1' => $graph1);
}
And in the tpl file:
<h3><?php echo t('Installs') . ' ' . $cell; ?></h3>
theme('flot_graph', $graph1);