|
Last change
on this file was 448, checked in by george, 17 years ago |
- Přesunuto: Obsah kořenové složky byl přesunut do složky trunk a beta web přesunut do branches/beta.
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 1 | <?php
|
|---|
| 2 |
|
|---|
| 3 | include_once('global.php');
|
|---|
| 4 |
|
|---|
| 5 | function ShowNews()
|
|---|
| 6 | {
|
|---|
| 7 | global $Database;
|
|---|
| 8 | $ItemPerPage = 5;
|
|---|
| 9 | if(array_key_exists('Page', $_GET)) $Page = $Database->real_escape_string($_GET['Page']); else $Page = 0;
|
|---|
| 10 | $Database->select_db('wow');
|
|---|
| 11 | $DbResult = $Database->query('SELECT COUNT(*) FROM news');
|
|---|
| 12 | $Total = $DbResult->fetch_array();
|
|---|
| 13 | $Total = $Total[0];
|
|---|
| 14 |
|
|---|
| 15 | $Result = '<strong>Aktuality:</strong>';
|
|---|
| 16 | $Result .= '<div style="NewsTable">';
|
|---|
| 17 | $DbResult = $Database->query('SELECT news.*, user.User as username FROM news JOIN user ON user.ID=news.user WHERE 1 ORDER BY time DESC LIMIT '.($Page * $ItemPerPage).','.$ItemPerPage);
|
|---|
| 18 | while($Row = $DbResult->fetch_array())
|
|---|
| 19 | {
|
|---|
| 20 | $Result .= '<div class="NewsItem">';
|
|---|
| 21 | if($Row['long_text'] != '') $Row['title'] = '<a href="?new_id='.$Row['id'].'">'.$Row['title'].'</a>';
|
|---|
| 22 | $Result .= '<div class="NewsItemTitle"><strong>'.$Row['title'].'</strong> ('.HumanDate($Row['time']).')</div>';
|
|---|
| 23 | $Result .= $Row['short_text'].' ('.$Row['username'].')</div>';
|
|---|
| 24 | }
|
|---|
| 25 | $Result .= '</div>';
|
|---|
| 26 | $Result .= PagesList('?Page=', $Page, $Total, $ItemPerPage);
|
|---|
| 27 | return($Result);
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|
| 30 | ?>
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.