<?php function mod_music_latest($module_id){ $inDB = cmsDatabase::getInstance(); $inCore = cmsCore::getInstance(); $cfg = $inCore->loadModuleConfig($module_id); $inCore->loadModel("music"); $model = cms_model_music::initmodel(); $model->orderBy($cfg['orderby'], $cfg['orderto']); $model->limitPage(1, $cfg['limit']); $musics = $model->getMusics(); if (!$musics){ echo "<p>Песни не найдены.</p>"; return true;} $html = "<table width=\"100%\">"; $k = 1; foreach ($musics as $music){ if ($k == 1){ $html .= "<tr>"; } $html .= "<td><img src=\"/components/music/images/music.png\"><a href=\"".$music['seo_music_url']."\" title=\"Cкачать и Слушать ".htmlspecialchars($music['singer'])." - ".htmlspecialchars($music['name'])." \">".substr($music['singer'],0,$cfg['singer_cut'])." - ".substr($music['name'],0,$cfg['name_cut'])."</a></td>"; if ($k == $cfg['maxcol']){ $html .= "</tr>"; $k = 1; }else{ $k++; } } if ($k != 1){ $html .= "</tr>"; } $html .= "</table>"; echo $html; return true; } ?>
cmsCore::loadModel('music'); $model = cms_model_music::initmodel(); $model->orderBy($cfg['orderby'], $cfg['orderto']); $model->limitPage(1, $cfg['limit']); $musics = $model->getMusics(); if (!$musics) { echo "<p>Песни не найдены.</p>"; return true; } $html = "<table width=\"100%\">"; $k = 1; foreach ($musics as $music) { if ($k == 1) { $html .= "<tr>"; } $html .= "<td><img src=\"/components/music/images/music.png\"><a href=\"" . $music['seo_music_url'] . "\" title=\"Cкачать и Слушать " . htmlspecialchars($music['singer']) . " - " . htmlspecialchars($music['name']) . " \">" . substr($music['singer'], 0, $cfg['singer_cut']) . " - " . substr($music['name'], 0, $cfg['name_cut']) . "</a></td>"; if ($k == $cfg['maxcol']) { $html .= "</tr>"; $k = 1; } else { $k++; } } if ($k != 1) { $html .= "</tr>"; } $html .= "</table>"; echo $html; return true; } ?>