Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The simplest approach is the one described by Sjoerd. If your page only contains some few elements, there is noting wrong with a switch or if statement.</p> <p>index.php:</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;!-- Wrapper div --&gt; &lt;div id="wrapper&gt; &lt;!-- Header div --&gt; &lt;div id="header"&gt; &lt;?php include('header.php'); // File containing header code ?&gt; &lt;/div&gt; &lt;!-- Content div --&gt; &lt;div id="content"&gt; &lt;!-- Left Colon div --&gt; &lt;div id="leftCol"&gt; &lt;?php include('leftMenu.php'); // File containing the menu ?&gt; &lt;/div&gt; &lt;!-- Center colon --&gt; &lt;div id="centerCol"&gt; &lt;?php $page = $_GET['page']; // To get the page if($page == null) { $page = 'index'; // Set page to index, if not set } switch ($page) { case 'index': include('frontPage.php'); break; case 'about': include('about.php'); break; case 'contact': include('contact.php'); break; } ?&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- Footer div --&gt; &lt;div id="footer"&gt; &lt;?php include('footer.php'); // File containing the footer ?&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>header.php:</p> <pre><code>&lt;?php echo "This is header"; ?&gt; </code></pre> <p>leftMenu.php:</p> <pre><code>&lt;?php echo "&lt;a href='index.php/?page=index'&gt;Front Page&lt;/a&gt;"; // set page to index echo "&lt;a href='index.php/?page=about'&gt;About&lt;/a&gt;"; // page = about echo "&lt;a href='index.php/?page=contact'&gt;Contact&lt;/a&gt;"; // page = contact ?&gt; </code></pre> <p>and so on</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload