dimanche 10 janvier 2016

My index.php file is showing all pages on my site at once

I am using an index.php file to include the header, navigation and footer on all pages on my site, however I have an issue with my php which is showing all pages within the pages folder at once, rather than just showing the page i'm am currently on.

Here is the PHP I am using, any advice would be appreciated!

                <?php
                $files = scandir( __DIR__ . '/pages' );

                unset( $files[0] );
                unset( $files[1] );

                foreach($files as $file){
                    include __DIR__ . '/pages/' . $file;
                }
            ?>




Aucun commentaire:

Enregistrer un commentaire