Skip to content
This repository has been archived by the owner on Jul 17, 2022. It is now read-only.

individual css styles for different values #113

Open
ayanu99 opened this issue Nov 24, 2019 · 0 comments
Open

individual css styles for different values #113

ayanu99 opened this issue Nov 24, 2019 · 0 comments

Comments

@ayanu99
Copy link

ayanu99 commented Nov 24, 2019

Hi everybody,
I'm currently trying to have an individual style (e.g. tr style = 'color: red;') for a row in the result list depending on the value of one column (column name: "risk") in my mysql table.
I tried to find a solution within the template in a way like it is done with not displaying one column ($style = (strtolower($columnName) === 'id') ? 'display: none;' : '';)

I thought about having something like:
if ($risk === 'high') {$style = 'color: red;'}
Of course, there is no variable called $risk yet, so the question is where to find the result of the mysql query in which the column "risk" is read and its value can be used for my if condition.
Any ideas anyone?

I think it must be done in this part of the code somewhere:

if (!empty($rows)) {
    foreach ($rows as $row) {
        $html .= '<tr>';
        foreach ($row as $columnName => $column) {
            $style = (strtolower($columnName) === 'id') ? 'display: none;' : '';
	           if (is_array($column)) {
                $content = '';
                foreach ($column as $aColumnKey => $aColumnValue) {
                    $content .= "{$aColumnKey} : {$aColumnValue} ";
                }
                $content = htmlspecialchars($content);
               $html .= "<td style='{$style}'>{$content}</td>";
		 
            } else {
                $column = htmlspecialchars($column);
               $html .= "<td style='{$style}'>{$column}</td>";
            }
        }
        $html .= '</tr>';

Thanks a lot for your help!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant