Welcome Guest, Not a member yet? Register   Sign In
IF $class = ($value->status == "done") HOW?
#3

I would propose another way. Make the following helper function, PHP:

Code:
function get_task_status_class($status) {

    $status = strtolower(str_replace('_', '-', $status));

    if (!in_array($status, array(
        'open',
        'in-progress',
        'done'
    ))) {

        return '';
    }

    return $status;
}

It is to be used within the views, for example:

Code:
<span class="task-name <?php echo get_task_status_class($status); ?>"><?php echo html_escape($task_name); ?></span>

And add to your CSS:

Code:
.task-name.open {
    color: #536699;
}

.task-name.in-progress {
    color: #796699;
}

.task-name.done {
    color: #336699;
}
Reply


Messages In This Thread
RE: IF $class = ($value->status == "done") HOW? - by ivantcholakov - 01-30-2017, 04:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB