?
avatar Poulius
Poulius
28 Dec 2017

Steps to reproduce the issue

Module doesn't add active class on active category url. In file tmpl/default_items.php line 13 there is a code line
if ($_SERVER['REQUEST_URI'] === JRoute::_(ContentHelperRoute::getCategoryRoute($item->id))) echo ' class="active"'; ?>> <?php $levelup = $item->level - $startLevel - 1;

Expected result

if ($_SERVER['REQUEST_URI'] === JRoute::_(ContentHelperRoute::getCategoryRoute($item->id)))

It should be true but it returns false

Actual result

var_dump(trim($_SERVER['REQUEST_URI'])); var_dump(trim(JRoute::_(ContentHelperRoute::getCategoryRoute($list[0]->id))));

Get

string(60) "/index.php?option=com_content&view=category&id=10&Itemid=105" string(72) "/index.php?option=com_content&view=category&id=10&Itemid=105"

System information (as much as possible)

SEF turned off

My Solution

change 13 line php code into
if (htmlspecialchars($_SERVER['REQUEST_URI']) === JRoute::_(ContentHelperRoute::getCategoryRoute($item->id))) echo ' class="active"'; ?>> <?php $levelup = $item->level - $startLevel - 1;

avatar Poulius Poulius - open - 28 Dec 2017
avatar joomla-cms-bot joomla-cms-bot - change - 28 Dec 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 28 Dec 2017
avatar Poulius Poulius - change - 28 Dec 2017
The description was changed
avatar Poulius Poulius - edited - 28 Dec 2017
avatar Poulius Poulius - change - 28 Dec 2017
The description was changed
avatar Poulius Poulius - edited - 28 Dec 2017
avatar Poulius Poulius - change - 28 Dec 2017
The description was changed
avatar Poulius Poulius - edited - 28 Dec 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 28 Dec 2017
Category com_modules
avatar franz-wohlkoenig franz-wohlkoenig - change - 28 Dec 2017
Status New Closed
Closed_Date 0000-00-00 00:00:00 2017-12-28 13:59:13
Closed_By franz-wohlkoenig
avatar joomla-cms-bot joomla-cms-bot - change - 28 Dec 2017
Closed_By franz-wohlkoenig joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 28 Dec 2017
avatar joomla-cms-bot
joomla-cms-bot - comment - 28 Dec 2017
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 28 Dec 2017

closed as having Pull Request #19197.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 28 Dec 2017

@Poulius please test Pull Request #19197.

Add a Comment

Login with GitHub to post a comment