Code:
<label for="category--' . $category . '" class="label label--checkbox">
<div id="option--'. $category .'"' . (($category == 'DRSS' || $category == 'SKTS') ? (($women_selected || !$men_selected) ? '' : ' style="display:none;"') : '') . '>
I don't think those PHP codes above are complete on their own.
For example this fragment of codes
Code:
<label for="category--' . $category . '" class="label label--checkbox">
It is more likely in this form
Code:
$var = '<label for="category--' . $category . '" class="label label--checkbox">';
Thus dependong on the value of the variable $category, if it is 'DRSS',
then the following similar code below will yield the same result_metadata()
Code:
$var = '<label for="category--DRSS" class="label label--checkbox">';
Another way of writing the above in a more readable manner is using PHP's variable interpolation, hence you can rewrite it as follows
Code:
$var = "<label for=\"category--$category\" class=\"label label--checkbox\">";
Since normally HTML strings can be single quoted or double quoted and the meaning is the same,
thus you can avoid escaping double quotes in a PHP string as follows
Code:
$var = "<label for='category--$category' class='label label--checkbox'>";
For the other fragment,
Code:
<div id="option--'. $category .'"' . (($category == 'DRSS' || $category == 'SKTS') ? (($women_selected || !$men_selected) ? '' : ' style="display:none;"') : '') . '>
It should be of this form too
Code:
$var = '<div id="option--'. $category .'"' . (($category == 'DRSS' || $category == 'SKTS') ? (($women_selected || !$men_selected) ? '' : ' style="display:none;"') : '') . '>';
The following code is analogous
Code:
if ($category == 'DRSS' || $category == 'SKTS') {
if ($women_selected || !$men_selected) {
$var = '<div id="option--'. $category .'">';
// or using variable interpolation and switching to wrapping double quotes
// $var = "<div id='option--$category'>";
}
else {
$var = '<div id="option--'. $category .'" style="display:none;">';
// or using variable interpolation and switching to wrapping double quotes
// $var = "<div id='option--$category' style='display:none;'>";
}
}
else {
$var = '<div id="option--'. $category .'">';
// or using variable interpolation and switching to wrapping double quotes
// $var = "<div id='option--$category'>";
}