When looking at the ZC 1.5.8 version of this area, I question the importance of *always* forcing the additional character(s) associated with $the_min_units and/or why the span's class must *always* encompass that information? E.g. why not place the span information after the additional assignment of $the_min_units instead of incorporating the span into the following text.
Instead of:
Code:
if ($check_max > 0) {
$the_min_units .= '<span class="qmax">';
if ($include_break == true) {
$the_min_units .= ($the_min_units != '' ? '<br>' : '');
} else {
$the_min_units .= ($the_min_units != '' ? ' ' : '');
}
$the_min_units .= PRODUCTS_QUANTITY_MAX_TEXT_LISTING . ' ' . $check_max;
$the_min_units .= '</span>';
}
Making it:
Code:
if ($check_max > 0) {
if ($include_break == true) {
$the_min_units .= ($the_min_units != '' ? '<br>' : '');
} else {
$the_min_units .= ($the_min_units != '' ? ' ' : '');
}
$the_min_units .= '<span class="qmax">';
$the_min_units .= PRODUCTS_QUANTITY_MAX_TEXT_LISTING . ' ' . $check_max;
$the_min_units .= '</span>';
}
Or if incorporating the above "breakElement":
Code:
if ($check_max > 0) {
$the_min_units .= ($the_min_units != '' ? $breakElement : '');
$the_min_units .= '<span class="qmax">';
$the_min_units .= PRODUCTS_QUANTITY_MAX_TEXT_LISTING . ' ' . $check_max;
$the_min_units .= '</span>';
}
If the "span" does need to fit around the break (assuming a break like character is needed because of earlier text), then would suggest generating an additional variable to support the check being able to omit inserting the break element when it is "currently" not required:
Code:
if ($check_max > 0) {
$span_max_class = '<span class="qmax">';
$the_min_units .= $span_max_class;
$the_min_units .= ($the_min_units != $span_max_class ? $breakElement : '');
$the_min_units .= PRODUCTS_QUANTITY_MAX_TEXT_LISTING . ' ' . $check_max;
$the_min_units .= '</span>';
}
This is suggested because there are those that don't want a break forced for an empty set of previous text either for html validation or look and to not require some sort of additional CSS, javascript/jQuery, or other code to "remove".
Bookmarks