Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Removed Drupal and version tag from title
Link
leymannx
  • 18.8k
  • 6
  • 72
  • 126

Drupal 7 Why is my theme table row array will not showbeing displayed?

Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
deleted 108 characters in body
Source Link
Scott Joudry
  • 4.2k
  • 3
  • 30
  • 47

I have the below code and I know both the $headers and the $html have values stored in them as i can echo them out. I can also set the 'header' => in the theme function to be either $header or $html and it will display the data.

However when I add in 'rows' =>, no data is displayed.

Can anyone see why?

function emnies_ad_hoc_query_exporter_get_html_formatted_ad_hoc_query_responses($obj_response) {
  $str_current_country = '';

  foreach ($obj_response as $response) {
    if ($str_current_country != $response->country) {
      $str_current_country = $response->country;
      $html = emnies_ad_hoc_query_exporter_get_country_row($str_current_country, $obj_response);
    }
  }
  $header = array('Country', 'Wider Dissemination', 'Responses'); 
  $output = theme('table', array(
                                                      'header' => $header, 
                                                       'rows' => $html
                        ));
  return $output;
}



function emnies_ad_hoc_query_exporter_get_country_row($str_current_country, $obj_response) {
  $rows = array();
   $i = 0;
  foreach ($obj_response as $response) {
    if ($str_current_country == $response->country) {
      if ($i == 0) {
        $rows[] = $str_current_country;
        $rows[] = $response->wider_dissemination;
      }
      $i = $i + 1;
      $rows[] = $response->response;
    }
  }
  return $rows;
}

I have the below code and I know both the $headers and the $html have values stored in them as i can echo them out. I can also set the 'header' => in the theme function to be either $header or $html and it will display the data.

However when I add in 'rows' =>, no data is displayed.

Can anyone see why?

function emnies_ad_hoc_query_exporter_get_html_formatted_ad_hoc_query_responses($obj_response) {
  $str_current_country = '';

  foreach ($obj_response as $response) {
if ($str_current_country != $response->country) {
  $str_current_country = $response->country;
  $html = emnies_ad_hoc_query_exporter_get_country_row($str_current_country, $obj_response);
}
  }
  $header = array('Country', 'Wider Dissemination', 'Responses'); 
  $output = theme('table', array(
                                                      'header' => $header, 
                                                       'rows' => $html
                        ));
  return $output;
}



function emnies_ad_hoc_query_exporter_get_country_row($str_current_country, $obj_response) {
  $rows = array();
   $i = 0;
  foreach ($obj_response as $response) {
    if ($str_current_country == $response->country) {
      if ($i == 0) {
        $rows[] = $str_current_country;
        $rows[] = $response->wider_dissemination;
      }
      $i = $i + 1;
      $rows[] = $response->response;
    }
  }
  return $rows;
}

I have the below code and I know both the $headers and the $html have values stored in them as i can echo them out. I can also set the 'header' => in the theme function to be either $header or $html and it will display the data.

However when I add in 'rows' =>, no data is displayed.

Can anyone see why?

function emnies_ad_hoc_query_exporter_get_html_formatted_ad_hoc_query_responses($obj_response) {
  $str_current_country = '';

  foreach ($obj_response as $response) {
    if ($str_current_country != $response->country) {
      $str_current_country = $response->country;
      $html = emnies_ad_hoc_query_exporter_get_country_row($str_current_country, $obj_response);
    }
  }
  $header = array('Country', 'Wider Dissemination', 'Responses'); 
  $output = theme('table', array(
    'header' => $header, 
    'rows' => $html
  ));
  return $output;
}



function emnies_ad_hoc_query_exporter_get_country_row($str_current_country, $obj_response) {
  $rows = array();
  $i = 0;
  foreach ($obj_response as $response) {
    if ($str_current_country == $response->country) {
      if ($i == 0) {
        $rows[] = $str_current_country;
        $rows[] = $response->wider_dissemination;
      }
      $i = $i + 1;
      $rows[] = $response->response;
    }
  }
  return $rows;
}
Source Link
James
  • 29
  • 1
  • 7

Drupal 7 theme table row array will not show

I have the below code and I know both the $headers and the $html have values stored in them as i can echo them out. I can also set the 'header' => in the theme function to be either $header or $html and it will display the data.

However when I add in 'rows' =>, no data is displayed.

Can anyone see why?

function emnies_ad_hoc_query_exporter_get_html_formatted_ad_hoc_query_responses($obj_response) {
  $str_current_country = '';

  foreach ($obj_response as $response) {
if ($str_current_country != $response->country) {
  $str_current_country = $response->country;
  $html = emnies_ad_hoc_query_exporter_get_country_row($str_current_country, $obj_response);
}
  }
  $header = array('Country', 'Wider Dissemination', 'Responses'); 
  $output = theme('table', array(
                                                      'header' => $header, 
                                                       'rows' => $html
                        ));
  return $output;
}



function emnies_ad_hoc_query_exporter_get_country_row($str_current_country, $obj_response) {
  $rows = array();
   $i = 0;
  foreach ($obj_response as $response) {
    if ($str_current_country == $response->country) {
      if ($i == 0) {
        $rows[] = $str_current_country;
        $rows[] = $response->wider_dissemination;
      }
      $i = $i + 1;
      $rows[] = $response->response;
    }
  }
  return $rows;
}