Closing tag </li> missing in nested lists
Posted: Thu 30. Nov 2006, 21:30
I found an error in the code generated by the list content type in phpwcms 1.2.8.
When a list is created and you have for instance:
the following HTML is created:
I noticed the absence of the closing tag of the 2nd item of the list. According to the html standard, that <li> tag should be closed after the inner <ul>...</ul>. So the correct html should be:
I found a solution that worked for me, but I'm not sure of its side effects.
In include/inc_front/content/cnt100.article.inc.php I moved line 119 out of the 'if' wrapping that line.
The original code (starting at line 112):
The modified code:
Regards
When a list is created and you have for instance:
Code: Select all
~Item1
~Item2
~~Item2a
~~Item2b
~Item3
Code: Select all
<ul>
<li>Item1</li>
<li>Item2
<ul>
<li>Item2a</li>
<li>Item2b</li>
</ul>
<li>Item3</li>
</ul>
Code: Select all
<ul>
<li>Item1</li>
<li>Item2
<ul>
<li>Item2a</li>
<li>Item2b</li>
</ul>
</li>
<li>Item3</li>
</ul>
In include/inc_front/content/cnt100.article.inc.php I moved line 119 out of the 'if' wrapping that line.
The original code (starting at line 112):
Code: Select all
if($clist_diff_next > 0) {
$crow["acontent_text"] .= "</li>\n</ul>\n";
if($clist_diff_next > 1) {
for($i=0; $i < (abs($clist_diff_next)-1); $i++) {
if(!$i) $crow["acontent_text"] .= "</li>\n";
$crow["acontent_text"] .= "</ul>\n";
}
$crow["acontent_text"] .= "</li>\n";
}
}
Code: Select all
if($clist_diff_next > 0) {
$crow["acontent_text"] .= "</li>\n</ul>\n";
if($clist_diff_next > 1) {
for($i=0; $i < (abs($clist_diff_next)-1); $i++) {
if(!$i) $crow["acontent_text"] .= "</li>\n";
$crow["acontent_text"] .= "</ul>\n";
}
}
$crow["acontent_text"] .= "</li>\n";
}