Ответов: 1 Просмотров: 142
|
PHP:
скопировать код в буфер обмена
$page = $_GET["page"]; if ($page < 1 or $page == "") $page = 1; $limit = 5; $start = getStart($page, $limit); $articles = getAllArticles($start, $limit); for ($i = 0; $i < count($articles); $i++) { if (isset($_GET['category'])) { $category = (int)$_GET['category']; $query = mysqli_query($connect,"SELECT * FROM `articles` WHERE `categorie_id`= $category ORDER BY `id` DESC LIMIT $start, $limit ");
Главная страница index.php
PHP:
скопировать код в буфер обмена
<?PHP require"application/includes/config.php"; require"application/includes/functions.php"; ?> <!DOCTYPE html> <html> <head> <?PHP $title="Ты в Спорте"; require_once "application/blocks/head.php"; ?> </head> <body> <?PHP require_once "application/blocks/top.php"; require_once "application/blocks/header.php"; ?> <div class="page"> <div class="container clear"> <div class="content"> <?PHP $page = $_GET["page"]; if ($page < 1 or $page == "") $page = 1; // количество строк-статей на стр. $limit = 15; // начало выборки из БД $start = getStart($page, $limit); $articles = getAllArticles($start, $limit); for ($i = 0; $i < count($articles); $i++) { ?> <div class="article"> <a href="article.php?id=<?PHP echo $articles[$i]['id']; ?>"><img class="article_img" alt="<?PHP echo $articles[$i]['title']; ?>" title="<?PHP echo $articles[$i]['title']; ?>" src="application/images/<?PHP echo $articles[$i]['image']; ?>"></a> <h1><?PHP echo $articles[$i]['title']; ?></h1> <p class="preliminary"> </p> <div class="data-cat"> <div class="data"> <img src="public/images/kalendar.png" class="below-img" style="width: 14px; height: 14px; float: left; margin-top: 1px; padding-right: 5px;"> <span class="article-data"> <a href="index.php" title="<?PHP echo russian_date($articles[$i]['pubdate']);?> "><?PHP echo russian_date($articles[$i]['pubdate']);?></a> </span> </div> <?PHP ?> <span class="categories"> <?PHP $art_cat=false; foreach ($catigories as $cat ) { if ($cat['id']==$articles[$i]['categorie_id']) { $art_cat=$cat; break; } } ?> <a href="category.php?id=<?PHP echo $art_cat['id']; ?>" title="<?PHP echo $art_cat['title'];?>"> <?PHP echo $art_cat['title'];?> </a> </span> </div> <div align="center" class="btn"> <a href="article.php?id=<?PHP echo $articles[$i]['id']; ?> ">Прочитать полностью</a> </div> </div> <?PHP } ?> <div class="paginator"> <?PHP echo pagination($page, $limit); ?> </div> </div> <?PHP require_once "application/blocks/sidebar.php"; ?> </div> <div class="clear"></div> </div> <?PHP require_once "application/blocks/footer.php"; ?> </body> </html>
|