Skip to content

Commit

Permalink
Related Articles By Keyword Returns Just a Text Label
Browse files Browse the repository at this point in the history
If no related articles by keyword are found, then nothing will be
displayed (including the label "You might also like").
  • Loading branch information
eSilverStrike committed Jan 4, 2017
1 parent eca724d commit 21decc5
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions system/classes/story.class.php
Expand Up @@ -1951,26 +1951,29 @@ public static function getRelatedArticlesByKeywords($articleId, $keywordList, $l
}
}

if (count($work) > 1) {
usort($work, array(__CLASS__, 'getRelatedArticlesSort'));
}
$retval = '';
if ($found) {
if (count($work) > 1) {
usort($work, array(__CLASS__, 'getRelatedArticlesSort'));
}

if (count($work) > $limit) {
$work = array_slice($work, 0, $limit);
}
if (count($work) > $limit) {
$work = array_slice($work, 0, $limit);
}

$encoding = COM_getEncodingt();
$retval = array();
$encoding = COM_getEncodingt();
$retval = array();

foreach ($work as $item) {
$retval[] = '<li>'
. '<a href="' . COM_buildURL($_CONF['site_url'] . '/article.php?story=' . $item['sid'])
. '">' . htmlspecialchars($item['title'], ENT_QUOTES, $encoding) . '</a>'
. '</li>' . PHP_EOL;
}
foreach ($work as $item) {
$retval[] = '<li>'
. '<a href="' . COM_buildURL($_CONF['site_url'] . '/article.php?story=' . $item['sid'])
. '">' . htmlspecialchars($item['title'], ENT_QUOTES, $encoding) . '</a>'
. '</li>' . PHP_EOL;
}

$retval = '<h3>' . $LANG24[92] . '</h3>' . PHP_EOL
. '<ul>' . PHP_EOL . implode('', $retval) . '</ul>' . PHP_EOL;
$retval = '<h3>' . $LANG24[92] . '</h3>' . PHP_EOL
. '<ul>' . PHP_EOL . implode('', $retval) . '</ul>' . PHP_EOL;
}

return $retval;
}
Expand Down

0 comments on commit 21decc5

Please sign in to comment.