How do I display a form followed by a table in a module??
I have this:
function main_function(){
$form = drupal_get_form("report_details_form");
$tabb = array(
'header' => $header,
'rows' => $rows,
'caption' => $caption,);
$output = theme("table", $tabb)
$final_output = theme("report_page", $form, $output);
return $final_output;
}
function theme_report_page($form, $result = array()) {
$output = '
<div id="report_form">
'. $form .'
</div>
<div id="report_result">
'. $result .'
</div>';
return $output;
}
What am I doing wrong? I am using Drupal 7. I need to display the form and under it the table. There is nothing wrong with $form or $output. If I return them in the main_function they will display correctly.
I don't NEED a theme, I just need to display a form and table on the same page. So if it is to demanding I can skip it, and just have the form and table displayed.
I changed the main_function a bit to this:
function main_function(){
$form = drupal_get_form("report_details_form");
$tabb = array(
'header' => $header,
'rows' => $rows,
'caption' => $caption,);
$output = theme("table", $tabb)
$build['content'] = array(
'this_does_not_matter_too_much2' => drupal_get_form("report_details_form"),
'this_does_not_matter_too_much1' => array('#markup' => $output,),);
$build['pager'] = array(
'#theme' => 'pager',
'#weight' => 5,
);
return $build;
A dummy table is now displayed, but just in the first call to the page, not when the page is self called after submiting the form for first time. A custom table is then created to list all the results for a SELECT. This custom table is not displayed for some reason.
HOOK_theme
in order to get your theming functiontheme_report_page
registered in drupal's theme registry. Saying "I don't NEED a theme" indicates you didn't understand his answer fully, so I thought I'd clarify & reiterate.