<div id="portfolio">
<?php $portfolio_title = get_portfolio_title();
foreach ($portfolio_title as $portfolio_title): ?>
<h1 class="header-portfolio"><?php echo $portfolio_title['title']; ?></h1>
<?php endforeach; ?>
<div class="portfolio-position">
<div class="portfolio-block">
<?php $portfolio = get_portfolio_all();
foreach ($portfolio as $portfolio): ?>
<div id="page-block" class="hide-show-info">
<h2 id="title-page"><?php echo $portfolio['portfolio_title']; ?></h2>
<p id="text-product"><?php echo $portfolio['portfolio_text']; ?></p>
<div class="flyout hidden">
<div class="button-product">
<a href="<?php echo $portfolio['portfolio_link']; ?>" target="_blank"><?php echo $portfolio['portfolio_button_text']; ?></a>
</div>
</div>
<div id="bg-mask" class="pic">
<img id="content-img" class="grayscale-mask" src="<?php echo 'admin/portfolio/upload/'.$portfolio['image']; ?>" alt="Portfolio">
</div>
</div>
<?php endforeach; ?>
</div>
<div class="more-portfolio">
<button>Показать больше</button>
</div>
</div>
</div>
function get_portfolio_all() {
global $connection;
$portfolio = $connection->query("SELECT * FROM portfolio ORDER BY id DESC LIMIT 4");
return $portfolio;
}
function get_portfolio_all($offset = 0, $limit = 4) {
global $connection;
$portfolio = $connection->prepare("SELECT * FROM portfolio ORDER BY id DESC LIMIT ?,?");
$portfolio->execute([$offset, $limit]);
return $portfolio->fetchAll(PDO::FETCH_ASSOC);
}