Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I can give you an example for the botom one. I did it for my page as well, however, instead of page=products, i have just adressed a single value you to it, in my case: p</p> <p>the link is then index.php?p=members</p> <p>Bassically what happens in here that my script checks what i give the to the value p. let me show you in a code</p> <p>html:</p> <pre><code> &lt;a href="index.php?p=members" title="Members"&gt;Members&lt;/a&gt; </code></pre> <p>I request the link p=members to be dynamically loaded in my hyperlink. What runs in my content area is a script that looks for that.</p> <pre><code>&lt;?php if (!empty($_GET['p'])){ $pages_dir = 'inc/content'; $pages = scandir($pages_dir, 0); unset($pages[0], $pages[1]); $p = $_GET['p']; if(in_array($p.'.inc.php', $pages)){ include($pages_dir.'/'.$p.'.inc.php'); } else { echo 'Sorry, page not found'; } } else { include($pages_dir.'/home.inc.php'); } ?&gt; </code></pre> <p>To spill it out, the if statement checks request the p value out of the hyperlink (remember i said in the html p=members?) i create a variable that checks the folder inc/content which contain my content pages. that variable contains an array with the names of the pages (the unset part is that it removes the . and .. within a folder) It creates an array. Then i let it run through another if else statement. This tells to look for the file name (members) with the taggs inc.php (the inc part is not needed, but i did it so it was clear that file was an include). If it is in the array, include it, if not, it tells me page not found. If there is no value in p (to close it) it basically opens my index page.</p> <p>I hope this helps</p>
 

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