Форум -> Обо всём... -> block-Center.php в три колонки |
block-Center.php в три колонки |
---|
RockKenny | Дата: 25.02.2008, в 07:24 | Сообщение №1 |
Активный участникПользователь №: 171 Сообщений: 232
| вот всем известный block-Center.php
Код | 1
| <?php
if (!defined('BLOCK_FILE')) {
Header("Location: ../index.php");
exit;
}
global $prefix, $db;
$strip = 23;
$content .= "<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\" class=\"bgcolor4\">";
$content .= "<tr><th>Файлы</th><th>Учебники</th><th>Вопросы и ответы</th></tr><tr class=\"bgcolor1\">";
// Last added Files
$content .= "<td valign=\"top\">";
$result = $db->sql_query("SELECT lid, title FROM ".$prefix."_files WHERE status !='0' ORDER BY lid DESC LIMIT 5");
while(list($lid, $title) = $db->sql_fetchrow($result)) {
$linkstrip = cutstr($title, $strip);
$content .= "<table cellspacing=\"0\" cellpadding=\"1\" border=\"0\"><tr><td><img src=\"images/blocks/Files.gif\" title=\"$title\"></td><td><a href=\"index.php?name=Files&op=view_file&lid=$lid\" title=\"$title\">$linkstrip</a></td></tr></table>";
}
// Last added Pages
$content .= "<td valign=\"top\">";
$result = $db->sql_query("SELECT pid, title FROM ".$prefix."_pages ORDER BY pid DESC LIMIT 5");
while(list($pid, $title) = $db->sql_fetchrow($result)) {
$linkstrip = cutstr($title, $strip);
$content .= "<table cellspacing=\"0\" cellpadding=\"1\" border=\"0\"><tr><td><img src=\"images/blocks/Pages.gif\" title=\"$title\"></td><td><a href=\"index.php?name=Pages&op=page&pid=$pid\" title=\"$title\">$linkstrip</a></td></tr></table>";
}
// Last added FAQ
$content .="<td valign=\"top\">";
$result = $db->sql_query("SELECT id_cat, categories FROM ".$prefix."_faqcategories ORDER BY id_cat DESC LIMIT 5");
while(list($id_cat, $categories) = $db->sql_fetchrow($result)) {
$linkstrip = cutstr($categories, $strip);
$content .= "<table cellspacing=\"0\" cellpadding=\"1\" border=\"0\"><tr><td><img src=\"images/blocks/FAQ.gif\" title=\"$categories\"></td><td><a href=\"index.php?name=FAQ&op=showcat&id_cat=$id_cat\" title=\"$categories\">$linkstrip</a></td></tr></table>";
}
$content .= "</td></tr></table>";
?> |
как сделать, чтоб в три колонки отображались только последние файлы? В итоге блок будет показывать 15 последних файлов но в три колонки. |
|
|
|
SHAKA1 | Дата: 25.02.2008, в 08:25 | Сообщение №2 |
УчастникПользователь №: 323 Сообщений: 77
| Пробуй так:
PHP - Код | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| <?php if (!defined('BLOCK_FILE')) { Header("Location: ../index.php"); exit; }
global $prefix, $db; $strip = 23; $content .= "<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\" class=\"bgcolor4\">"; $content .= "<tr><th>Файлы #1</th><th>Файлы #2</th><th>Файлы #3</th></tr><tr class=\"bgcolor1\">";
// Last added Files $content .= "<td valign=\"top\">"; $i='0'; $result = $db->sql_query("SELECT lid, title FROM ".$prefix."_files WHERE status !='0' ORDER BY lid DESC LIMIT 15"); while(list($lid, $title) = $db->sql_fetchrow($result)) { $i++; $linkstrip = cutstr($title, $strip); $content .= "<table cellspacing=\"0\" cellpadding=\"1\" border=\"0\"><tr><td><img src=\"images/blocks/Files.gif\" title=\"$title\"></td><td><a href=\"index.php?name=Files&op=view_file&lid=$lid\" title=\"$title\">$linkstrip</a></td></tr></table>"; if ($i==5 || $i==10) { $content .="<td valign=\"top\">";} } $content .= "</td></tr></table>"; ?> |
|
|
|
RockKenny | Дата: 25.02.2008, в 09:37 | Сообщение №3 |
Активный участникПользователь №: 171 Сообщений: 232
| SHAKA1, спасибо тебе, работает |
|
|
TaJIu4 | Дата: 25.02.2008, в 21:35 | Сообщение №4 |
ПользовательПользователь №: 307 Сообщений: 32
| а можно сделать такой центральный блок?:) последние новости, последние фотки в галерее и например текущий опрос |
|
|
|
Вы не можете ответить в тему анонимно, пожалуйста, войдите или зарегистрируйтесь!
|