Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8380647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:30:38+00:00 2026-06-09T16:30:38+00:00

Ok, will try be as clear as possible here. I am trying to produce

  • 0

Ok, will try be as clear as possible here. I am trying to produce a pdf document with various fields that display product information. Essentially, the script that produces the pdf will determine whether a change in the product has been initiated, if it has then the pdf will be created.

What I am trying to do now is highlight the field with those changes. To check whether there are changes I am using the following variables (of which there are about thirty)

$cone
$ctwo..... etc

An example of the array for the product output in the PDF file is:

    $leftHeadArray[0]['leftText']  = 'ID';
    $leftHeadArray[0]['rightText'] = $ID;


    $leftHeadArray[1]['leftText']  = 'start';
    $leftHeadArray[1]['rightText'] = date("d/m/Y", $Start);


    $leftHeadArray[2]['leftText']  = 'End';
    $leftHeadArray[2]['rightText'] = date("d/m/Y", $End);

The format and cell is then initated below this at:

$maxheader = max(array_keys($leftHeadArray), array_keys($midHeadArray), array_keys($rightHeadArray));

    for ($i = 0; $i <= max($maxheader); $i++)
    {
        if (isset($leftHeadArray[$i]))
        {
            $pdf->SetFont('helvetica', 'B', 6);
            $pdf->SetFillColor(128, 0, 0);
            $pdf->SetTextColor(255, 255, 255);

            $pdf->Cell(40, 5, $leftHeadArray[$i]['leftText'], $border, 0, 'L', 1);

            $pdf->SetFont('helvetica', 'N', 6);
            if ($ctwentytwo == 0 && $leftHeadArray[1]['rightText'] || $ctwentytwo == 0 && $leftHeadArray[4]['rightText'] ){
            $pdf->SetFillColor(255, 255, 255);
            $pdf->SetTextColor(0, 0, 0);
            }else{
            $pdf->SetFillColor(0, 0, 0);
            $pdf->SetTextColor(255, 255, 255);
            }

        $pdf->Cell(30, 5, $leftHeadArray[$i]['rightText'], $border, 0, 'L', 1);
        $pdf->Cell(20, 5, '', 0, 0, 'L', 0);
    }

Things I have tried already:

  1. wrapping if else statements around the inidividual cell arrays

    (e.g. $leftHeadArray[0][‘leftText’] = ‘ID’;
    $leftHeadArray[0][‘rightText’] = $ID;)

    and trying to over-ride the set fill color within there

  2. putting the if else statement within the if isset section

Things I am struggling with:

  • connecting the $cone to the $leftheadarray
  • changing just the one cell when a change is initiated

I hope this is concise!

//—————————— RESOLVED

The variable is always assumed as 0 so needed to make the declatation if $cone == 1 and relate back to the left head array as below: hope this helps!

if (isset($leftHeadArray[$i]))
        {
            $pdf->SetFont('helvetica', 'B', 6);
            $pdf->SetFillColor(128, 0, 0);
            $pdf->SetTextColor(255, 255, 255);

            $pdf->Cell(40, 5, $leftHeadArray[$i]['leftText'], $border, 0, 'L', 1);

            $pdf->SetFont('helvetica', 'N', 6);

            $pdf->SetFillColor(255, 255, 255);
            $pdf->SetTextColor(128, 0, 0);


            if (($ctwentytwo == 1) && ($leftHeadArray[$i]['leftText'] == "Promotion Start Date")
            ||  ($cone == 1) && ($leftHeadArray[$i]['leftText'] == "Promotion ID")
            ||  ($ctwo == 1) && ($leftHeadArray[$i]['leftText'] == "Promotion Type"))#|| $ctwentytwo == 0 && $leftHeadArray[1]['rightText']
            {
                $pdf->SetFillColor(0, 0, 0);
                $pdf->SetTextColor(255, 255, 255);
            }

            $pdf->Cell(30, 5, $leftHeadArray[$i]['rightText'], $border, 0, 'L', 1);
            $pdf->Cell(20, 5, '', 0, 0, 'L', 0);
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:30:40+00:00Added an answer on June 9, 2026 at 4:30 pm
    if (isset($leftHeadArray[$i]))
            {
                $pdf->SetFont('helvetica', 'B', 6);
                $pdf->SetFillColor(128, 0, 0);
                $pdf->SetTextColor(255, 255, 255);
    
                $pdf->Cell(40, 5, $leftHeadArray[$i]['leftText'], $border, 0, 'L', 1);
    
                $pdf->SetFont('helvetica', 'N', 6);
    
                $pdf->SetFillColor(255, 255, 255);
                $pdf->SetTextColor(128, 0, 0);
    
    
                if (($ctwentytwo == 1) && ($leftHeadArray[$i]['leftText'] == "Promotion Start Date")
                ||  ($cone == 1) && ($leftHeadArray[$i]['leftText'] == "Promotion ID")
                ||  ($ctwo == 1) && ($leftHeadArray[$i]['leftText'] == "Promotion Type"))#|| $ctwentytwo == 0 && $leftHeadArray[1]['rightText']
                {
                    $pdf->SetFillColor(0, 0, 0);
                    $pdf->SetTextColor(255, 255, 255);
                }
    
                $pdf->Cell(30, 5, $leftHeadArray[$i]['rightText'], $border, 0, 'L', 1);
                $pdf->Cell(20, 5, '', 0, 0, 'L', 0);
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I will try to be as clear as possible. Here What I am trying
I will try to be as clear as possible because I can't get anybody
OK. I will try to be as clear as possible and give my source
I will try to make myself as clear as possible. Let start from the
Been a tough week, will try to make this as clear as possible. Appreciate
I will try to make this as clear as I can, but if you
Sorry if the post title wasn't clear, I will try to explain a little
I will try to keep this as simple as possible. I have a rather
I'll try to expose as clear as possible ;) Well, i need to store
Let me try and be as much clear as possible although it won't be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.