Skip to content Skip to sidebar Skip to footer

Multiple Html Pages In One File

Hi guys I am making a website for a school project, but to keep in organised, I want to have all pages in one document, and when you go to the site the default page is index.php, a

Solution 1:

A very basic example of how it works :

<?php$page = $_GET['page'];

if ( $page == 'one' ) {
    echo'This is page one!';
} elseif ( $page == 'two' ) {
    echo'This is page to';
}

// http://yoursite.com/index.php?page=one// Outputs 'This is page one!'

Learn little more about GET request right here : $_GET

Solution 2:

This will help you: Serve multiple pages from 1 PHP file?1

If you want to make something like youtube.com/?watch=XXXXXXXXX so you need just to change XXXXXXXXX to display multiple content.

but you still can use :

  1. One-page navigation system.
  2. Display / Hides Pages With JS

Example Of JavaScript:

we have website1 as a website

we have a - b - c - d as pages

js will hide all pages exept the page you want to show.

Post a Comment for "Multiple Html Pages In One File"