What is the best way to integrate a gallery page into a PHP website with a three-column layout?

To integrate a gallery page into a PHP website with a three-column layout, you can use a combination of HTML, CSS, and PHP. First, create a PHP script to retrieve images from a directory and display them in a grid layout with three columns. Then, use CSS to style the gallery page and make it responsive. Finally, link the gallery page to your website navigation for easy access.

<?php
$dir = 'images/gallery/';
$files = scandir($dir);

echo '<div class="gallery">';
foreach($files as $file){
    if($file != '.' && $file != '..'){
        echo '<div class="gallery-item">';
        echo '<img src="' . $dir . $file . '" alt="' . $file . '">';
        echo '</div>';
    }
}
echo '</div>';
?>