Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $news = mysqli_query($connection, "SELECT * FROM `articles_categories` WHERE `id`");
- while ( $new = mysqli_fetch_assoc($news) )
- {
- ?>
- <div class="block">
- <a href="/articles.php?categorie=<?php echo $new['id']; ?>">Все записи</a>
- <h3><?php echo $new['title']; ?> [Новейшее]</h3>
- <div class="block__content">
- <div class="articles articles__horizontal">
- <?php
- $articles = mysqli_query($connection, "SELECT * FROM `articles` WHERE `categorie_id` = 1 ORDER BY `id` DESC LIMIT 4");
- while($art = mysqli_fetch_assoc($articles))
- {
- ?>
- <article class="article">
- <div class="article__image" style="background-image: url(/static/images/<?php echo $art['image']; ?>);"></div>
- <div class="article__info">
- <a href="/article.php?id=<?php echo $art['id']; ?>"><?php echo $art['title']; ?></a>
- <div class="article__info__meta">
- <?php
- $art_cat = false;
- foreach( $categories as $cat )
- {
- if ( $cat['id'] == $art['categorie_id'] )
- {
- $art_cat = $cat;
- break;
- }
- }
- ?>
- <small>Категория: <a href="/articles.php?categorie=<?php echo $art_cat['id']; ?>"><?php echo $art_cat['title']; ?></a></small>
- </div>
- <div class="article__info__preview"><?php echo mb_substr(strip_tags($art['text']), 0, 80, 'utf-8'); echo ' ...'; ?></div>
- </div>
- </article>
- <?php
- }
- ?>
- </div>
- </div>
- </div>
- <?php
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement