Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>i think the anchors are okay, but you should improve the server-side script as it outputs just the main content, not the whole page.</p> <p>by checking $_SERVER['HTTP_X_REQUESTED_WITH'] you can distinguish between an ajax-call and a "normal" request. this is a header set automatically by jquery.</p> <p>if an ajax-call is made, output the main content, otherwise output everything: the doctype, the html-tags and all the fun stuff that's between them. so everybody gets the content, even crawler and other visitors without javascript.</p> <p>further info: <a href="http://davidwalsh.name/detect-ajax" rel="nofollow">http://davidwalsh.name/detect-ajax</a></p> <p>example:</p> <pre><code>&lt;?php $pageID = isset($_POST['page']) ? $_POST['page'] : "home"; if ( !$_SERVER['HTTP_X_REQUESTED_WITH'] ) { require('content/components/header.php'); } require "content/" . $pageID . ".php"; if ( !$_SERVER['HTTP_X_REQUESTED_WITH'] ) { require('content/components/footer.php'); } ?&gt; </code></pre> <p>with content/components/header.php:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;link rel="stylesheet" type="text/css" href="style.css" /&gt; &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="scripts.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div class='siteBody'&gt; &lt;div class='siteHeader'&gt; &lt;?php foreach ($pageList as $key =&gt; $value) { if ($pageID == $key) {$btnClass="btnMenuSel";} else {$btnClass="btnMenu";} echo "&lt;a class='$btnClass' href='?page=".$key."'&gt;".$pageList[$key]."&lt;/a&gt;"; } ?&gt; &lt;/div&gt; &lt;div id="siteContent" style='margin-top:10px;'&gt; </code></pre> <p>and content/components/footer.php:</p> <pre><code> &lt;/div&gt; &lt;div class='siteFooter'&gt;&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    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. This table or related slice is empty.
    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