1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-08-03 11:47:51 +02:00

Sitemap Errors - ERROR 2 #175

This commit is contained in:
metal_gvc
2014-03-18 21:31:46 +02:00
parent bd3df9598a
commit cec57dc108

View File

@@ -2,28 +2,46 @@
<ul>
<?php
$sitemap_html = '';
// Display pages
if (count($pages_list) > 0) {
$children_started = false;
$first = true;
foreach ($pages_list as $page) {
if (trim($page['parent']) === '' && $children_started) {
$children_started = false;
$sitemap_html .= "</li></ul></li>\n";
} elseif(!$first && (trim($page['parent']) !== '' && $children_started || trim($page['parent']) === '')) {
$sitemap_html .= "</li>\n";
}
if (trim($page['parent']) !== '') $parent = $page['parent'].'/'; else $parent = '';
if (trim($page['parent']) !== '') { echo '<ul>'."\n"; }
echo '<li><a href="'.Option::get('siteurl').'/'.$parent.$page['slug'].'">'.$page['title'].'</a></li>'."\n";
if (trim($page['parent']) !== '') { echo '</ul>'."\n"; }
if (trim($page['parent']) !== '' && !$children_started) {
$children_started = true;
$sitemap_html .= "<ul>\n";
}
$sitemap_html .= '<li><a href="'.Option::get('siteurl').'/'.$parent.$page['slug'].'">'.$page['title'].'</a>';
$first = false;
}
if (trim($page['parent']) === '' && $children_started) {
$sitemap_html .= "</li></ul></li>\n";
} else {
$sitemap_html .= "</li>\n";
}
if (count($components) == 0) { echo '<ul>'."\n"; }
}
// Display components
if (count($components) > 0) {
if (count($pages_list) == 0) { echo '<ul>'."\n"; }
foreach ($components as $component) {
echo '<li><a href="'.Option::get('siteurl').'/'.$component.'">'.__(ucfirst($component), $component).'</a></li>'."\n";
$sitemap_html .= '<li><a href="'.Option::get('siteurl').'/'.$component.'">'.__(ucfirst($component), $component).'</a></li>'."\n";
}
if (count($pages_list) == 0) { echo '</ul>'."\n"; }
}
echo $sitemap_html;
?>
</ul>