Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ContentBuildRoute does not remove layout if link attached to menu item #141

Closed
ryandemmer opened this issue Feb 28, 2012 · 1 comment
Closed

Comments

@ryandemmer
Copy link
Contributor

In components/com_content/router.php, the following condition (line 47) does not remove the layout from the query :

// are we dealing with an article or category that is attached to a menu item?
if (($menuItem instanceof stdClass) && $menuItem->query['view'] == $query['view'] && isset($query['id']) && $menuItem->query['id'] == intval($query['id'])) {
        unset($query['view']);

        if (isset($query['catid'])) {
            unset($query['catid']);
        }

        unset($query['id']);

        return $segments;
    }

this may result in links like index.php/extensions?layout=blog, where the original link was something like index.php?option=com_content&view=category&layout=blog&id=20&Itemid=527

Easily fixed by removing the layout from the $query, eg:

// are we dealing with an article or category that is attached to a menu item?
if (($menuItem instanceof stdClass) && $menuItem->query['view'] == $query['view'] && isset($query['id']) && $menuItem->query['id'] == intval($query['id'])) {
        unset($query['view']);

        if (isset($query['catid'])) {
            unset($query['catid']);
        }
        
        if (isset($query['layout'])) {
            unset($query['layout']);
        }

        unset($query['id']);

        return $segments;
    }
@ryandemmer
Copy link
Contributor Author

Re-submitted with pull request

wilsonge pushed a commit that referenced this issue Jun 4, 2017
richard67 pushed a commit to richard67/joomla-cms that referenced this issue Apr 3, 2020
Update nl-NL.com_patchtester.ini
hans2103 pushed a commit to hans2103/joomla-cms that referenced this issue Oct 5, 2020
link in the footer "author-login" as alias
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants