$i = 0; foreach ($newsbyKeywords as $n) { if ($n["news"] == $id) { continue; } if (in_array($n["news"], $lineked_news)) { continue; } $tpl['news']['linked'][] = $n; $lineked_news[] = $n["news"]; $i++; if ($i == 2) { break; } } $tpl['news']['byBiblio'] = $news_class->getBiblioByKeywords($keywords, $id); $tpl['news']['show_relation'] = array(); $itemsShopcoins = array(); $shopcoins_name = ''; $shopcoins_id = 0; if ($tpl['news']['data']["shopcoins"]) { $itemsShopcoins = $shopcoins_class->findByIds(explode(',', $tpl['news']['data']["shopcoins"])); } foreach ($itemsShopcoins as $item) { $tpl['news']['show_relation'][] = $item; $shopcoins_name = $item['name']; $shopcoins_id = $item['shopcoins']; } if ($tpl['news']['data']["group"]) { $relations = $shopcoins_class->getRelatedByGroup($tpl['news']['data']["group"], $shopcoins_name, $shopcoins_id); foreach ($relations as $item) {