$arr = array();
unset($arr[0]);
array_push($arr, 1);
////////////////////////////////////////////////////////////////////
//Все новости
////////////////////////////////////////////////////////////////////
//Заголовок
head( $language['news_11'] );
//Статусы
if( $_GET['status'] == '1' ){
msg( $language['news_12'] );
}
//Постраничная навигация
$db->query( "SELECT * FROM news", 1 );
$count_news = $db->num_rows();
list( $pagertop, $pagerbottom, $limit ) = pager( '10', $count_news, 'news.php?' );
$db->query(
"SELECT n.* , u.name AS user_name , u.class AS user_class , u.avatar
FROM news AS n
LEFT JOIN users AS u ON u.id = n.id_user
ORDER BY n.date DESC
" . $limit . ""
);
echo '<div style="background: #c44; padding 10px;">Affected rows:'.$db->num_rows().'</div>';
if( !$db->num_rows() ){
msg( $language['default_8'], $language['news_13'] );
}else{
echo $pagertop;
while($arr = $db->get_row()){
//Номер новости
$id = $arr['id'];
//Название новости
$name = htmlspecialchars( $arr['name'] );
//Текст новости
$text = cleanhtml( $arr['text'] );
//Дата добавления
$date = convent_date( $arr['date'] );
//Имя пользователя
$user_name = $arr['user_name'];
//Класс пользователя
$user_class = $arr['user_class'];
//Номер пользователя
$user_id = $arr['id_user'];
//Аватар пользователя
$avatar = ( $arr['avatar'] ? '' . $arr % 5B'avatar' % 5D . '' : 'default_avatar.gif');
//Дополнительные поля
$field = '';
echo '<div style="background: #c44; padding 10px;">single row iteration:'.$id.'</div>';
//Подключаем шаблон
require 'templates/' . $config['template'] . '/tpl.news.php';
}
echo $pagertop;
echo '
';
}
SELECT n.* , u.name AS user_name , u.class AS user_class , u.avatar FROM news AS n LEFT JOIN users AS u ON u.id = n.id_user ORDER BY n.date DESC LIMIT 0 , 10