Cat 2 in related content

2 posts by 2 authors in: Forums > CMS Builder
Last Post: July 18, 2017   (RSS)

By osga - July 11, 2017

It came to out attention that the "related Files Setin in our articles was not pickin up the "Category 2" Titles... How can we adjust our code for that? Included is our page template, "Related Content" starts on Line 365

By Dave - July 18, 2017

Hi osga, 

It looks like it should be loading articles that have the same categoryNum.

You can try showing what MySQL query is being used to load related articles by adding 'debugSql' => true (see below).  And you can put a showme() statement right below that see what's being loaded.

$where = "categoryNum = '".mysql_escape($articlesRecord['categoryNum'])."' AND num != '".intval($articlesRecord['num'])."'";     
list($relatedArticles, $relatedArticlesMetaData) = getRecords(array(
'tableName' => 'articles',
'allowSearch' => false,
'limit' => 5,
'orderBy' => 'createdDate DESC',
'where' => $where,
'debugSql' => true, // debug
));
showme($relatedArticles); exit; // debug

Let me know what you find out.

Dave Edis - Senior Developer
interactivetools.com