Jump to content

Add bgcolor to $header - newbie help...


tazdevil

Recommended Posts

Please can someone help me... I am a complete PHP newbie!

 

I need to make the header of the following PHP code have a header row colour of

bgcolor="#23AA49"

 

Where & how do I add this to the following code?

 

thanks

 

 function phptemplate_cart_review_form(&$form) {
  $f =& $form['cart'];

     $header  = array(t('License Qty'), t('Product'), '', t('Price (each)'), '', '', '', t('Subtotal'), '');
  $rows = array();
  if ($f['items']) {
    foreach ($f['items'] as $key => $line) {
      if (is_numeric($key)) {
        $rows[] = array(
        $line['qty']['#value'],
        $line['item']['#value']->title,
        '',
        array('data' => payment_format($line['price']['#value']), 'align' => 'left'),
        '',
        '',
        array('data' => $line['Calculation']['#value'], 'align' => 'left'),
        array('data' => payment_format($line['subtotal']['#value']), 'align' => 'left'),
        $line['options']['#value']
        );
      }
    }
  }

  $rows[] = array('', '', '','', '', '');
  foreach ($f['totals'] as $id => $line) {
    if (is_numeric($id)) {
      $rows[] = array(
      '',
      '',
      '',
      '',
      '', 
      "<b>{$line['#title']}</b>",
      '',
      array('data' => payment_format($line['#value']), 'align' => 'left'),
      
      ''
      );
    }
  }

  $content .= theme('table', $header, $rows);

  return theme('box', t('Order Summary'), $content);
}

 

Link to comment
https://forums.phpfreaks.com/topic/88949-add-bgcolor-to-header-newbie-help/
Share on other sites

Really hard to understand what's going on in this code - there must be some serious use of classes I guess. My best suggestion is to look at this line:

 

     "<b>{$line['#title']}</b>",

 

And insert the formatting there, so perhaps something like:

 

     "<span style=\"font-weight: bold; bgcolor: #23AA49\">{$line['#title']}</span>",

 

Hope this helps ...

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.