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

On search results, highlight searched word in item title - issue #11996 #16484

Merged
merged 1 commit into from Jun 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/com_search/views/search/tmpl/default_results.php
Expand Up @@ -16,10 +16,10 @@
<?php echo $this->pagination->limitstart + $result->count . '. '; ?>
<?php if ($result->href) : ?>
<a href="<?php echo JRoute::_($result->href); ?>"<?php if ($result->browsernav == 1) : ?> target="_blank"<?php endif; ?>>
<?php echo $this->escape($result->title); ?>
<?php echo $result->title; ?>
</a>
<?php else : ?>
<?php echo $this->escape($result->title); ?>
<?php echo $result->title; ?>
<?php endif; ?>
</dt>
<?php if ($result->section) : ?>
Expand Down
1 change: 1 addition & 0 deletions components/com_search/views/search/view.html.php
Expand Up @@ -267,6 +267,7 @@ public function display($tpl = null)
$created = '';
}

$result->title = StringHelper::str_ireplace($needle, $hl1 . $needle . $hl2, htmlspecialchars($result->title, ENT_COMPAT, 'UTF-8'));
$result->text = JHtml::_('content.prepare', $result->text, '', 'com_search.search');
$result->created = $created;
$result->count = $i + 1;
Expand Down