thorsten/phpMyFAQ — Issue #342: Empty ul elements in Sitemap
Author: tipichris
Created: 2011-11-08 16:30:21+00:00
State: open

If there are no questions filed under 'A', the initial sitemap page produces invalid HTML. It creates the `

` element, but has nothing to fill it with. The following patch will only write out the `

` element if it has contents.

```
--- Sitemap.php.orig 2011-11-06 13:47:11.000000000 +0000
+++ Sitemap.php 2011-11-06 13:48:13.000000000 +0000
@@ -245,7 +245,7 @@

$letter = PMF_String::strtoupper($this->db->escape_string(PMF_String::substr($letter, 0, 1)));

- $writeMap = '

';
+ $writeMap = '';

switch($this->type) {
case 'db2':
@@ -348,7 +348,7 @@
$oldId = $row->id;
}

- $writeMap .= '

';
+ $writeMap = empty($writeMap)?'':'

' . $writeMap . '

';

return $writeMap;
}
```