diff --git a/components/com_content/helpers/legacyrouter.php b/components/com_content/helpers/legacyrouter.php index 5b2dc90e03907..4529c8c942399 100644 --- a/components/com_content/helpers/legacyrouter.php +++ b/components/com_content/helpers/legacyrouter.php @@ -237,7 +237,7 @@ public function build(&$query, &$segments) } } - if (isset($query['year']) && isset($query['month'])) + if (isset($query['month'])) { if ($menuItemGiven) { @@ -384,7 +384,7 @@ public function parse(&$segments, &$vars) * because the first segment will have the target category id prepended to it. If the * last segment has a number prepended, it is an article, otherwise, it is a category. */ - if (!$advanced) + if ((!$advanced) && ($item->query['view'] !== 'archive')) { $cat_id = (int) $segments[0]; @@ -405,6 +405,16 @@ public function parse(&$segments, &$vars) return; } + // Manage the archive view + if ($item->query['view'] == 'archive' && $count !== 1) + { + $vars['year'] = $count >= 2 ? $segments[$count - 2] : null; + $vars['month'] = $segments[$count - 1]; + $vars['view'] = 'archive'; + + return; + } + // We get the category id from the menu item and search from there $id = $item->query['id']; $category = JCategories::getInstance('Content')->get($id); @@ -456,18 +466,8 @@ public function parse(&$segments, &$vars) $cid = $segment; } - $vars['id'] = $cid; - - if ($item->query['view'] == 'archive' && $count != 1) - { - $vars['year'] = $count >= 2 ? $segments[$count - 2] : null; - $vars['month'] = $segments[$count - 1]; - $vars['view'] = 'archive'; - } - else - { - $vars['view'] = 'article'; - } + $vars['id'] = $cid; + $vars['view'] = 'article'; } $found = 0;