-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Set active class in mod_articles_categories when SEF is off #19197
Set active class in mod_articles_categories when SEF is off #19197
Conversation
How do you think about using code like this:
$input = JFactory::getApplication()->input;
$option = $input->getCmd('option');
$view = $input->getCmd('view');
$id = $input->getInt('id');
if ($option == 'com_content' && $view == 'category' && $id == $item->id) echo ' class="active"'; |
@joomdonation Your suggestion is good, thanks. |
I have tested this item ✅ successfully on f4dce78 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19197. |
foreach ($list as $item) : ?> | ||
<li <?php if ($_SERVER['REQUEST_URI'] === JRoute::_(ContentHelperRoute::getCategoryRoute($item->id))) echo ' class="active"'; ?>> <?php $levelup = $item->level - $startLevel - 1; ?> | ||
<li <?php if ($id == $item->id && $view == 'category' && $option == 'com_content') echo ' class="active"'; ?>> <?php $levelup = $item->level - $startLevel - 1; ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the space after <li
since there is a space before class
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
I have tested this item ✅ successfully on fc0c98f This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19197. |
@joomdonation can you please retest? |
@franz-wohlkoenig It is only coding style to remove an extra space. It does not affect test result. |
The last change is just code style, so my test is still success. You can mark this PR as RTC |
Ready to Commit after two successful tests. |
Pull Request for Issue #19194 .
Summary of Changes
Do not replace
&
by&
in URL inJRoute::_(...)
when comparing to$_SERVER['REQUEST_URI']
Testing Instructions
Test issue #19194
Expected result
When SEF is off.
Active class will appear when we are on the category page.
Actual result
When SEF is off active class in (
<li class="active">
) is missing.Documentation Changes Required
None