0

I'd like to add a class with the same name as the header, in order to keep similar header columns the same size. Basically, the code is generating multiple tables, some of which have the same header items, and some of which do not. All columns with the same header value will take the exact same styling.

$string .= theme('table', array('header' => array_values($headers[$group]), 'rows' => $results));

$string is '' at the beginning of this, and I want to add the class to the values in $header - so ideally it would look like this:

<th class="Header">Header</th>
0

You'll want to consider doing this in PHP, by overriding the theme/output markup for each Table Header, specifically using the theme_table() override function to add a class attribute to each table header argument.

Simplified code sample

$table_headers = array(
      array(
        'class' => array($node->title), // Adds 'class' HTML attribute.
      ),
      // More code goes here to define the table headers...
    );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.