Reputation: 859
With the code below:
'<ul class="qandaul"><li>'.htmlspecialchars( is_array( $arrImageFile[$key] ) ? implode(",", $arrImageFile[$key]) : $arrImageFile[$key] ) ). '</li></ul>'
When I go on the view page source, it highlights in red </li></ul>
, the reason it does this is because it it not displaying the <ul><li>
start tags to associate with them. My question is with code above, where am I suppsoe to place the <ul><li>
tags so that it shows up in view source meaning I know the tags are placed in the correct posistion?
UPDATE:
Below is the generated HTML from view source:
<td width="11%" class="imagetd"> </li></ul></td>
Below is the php/html code in full:
echo '<td width="11%" class="imagetd">'. ( ( empty ($arrImageFile[$key]) ) ? " " : '<ul class="qandaul"><li>'.htmlspecialchars( is_array( $arrImageFile[$key] ) ? implode(",", $arrImageFile[$key]) : $arrImageFile[$key] ) ). '</li></ul></td>' . PHP_EOL;
Upvotes: 1
Views: 129
Reputation: 173562
Some of your parentheses fall short somewhere, but it's just easier to rewrite it like this; not everything should be a one-liner after all and especially nested ternary operators:
echo '<td width="11%" class="imagetd">';
if (empty($arrImageFile[$key])) {
echo ' ';
} else {
echo '<ul class="qandaul"><li>';
echo htmlspecialchars(is_array($arrImageFile[$key]) ? implode(",", $arrImageFile[$key]) : $arrImageFile[$key]);
echo '</li></ul>';
}
echo '</td>';
Upvotes: 1