Jump to content

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 ...

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.