0

Well i was wordering how can i do one file for whole site or with includes.
Example i see some sites have index.php?page=register etc or index.php?page=portofolio
How can i do that without if else because i have problems with it.

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by ZozOQ
0

Most likely the contents come from a database table. It searches for "register" and returns the contents associated with it.

0

the ? passes parameters
and the PHP code reads those parameters.

for example I can point a link to index.php?site=privacypolicy

and on my index page include a PHP code that acts depending on those paraemeters
example:

<?php 
if (isset($_GET['site'])) {
$page = $_GET['site'];

switch($page){
case "articles": include("inc/articles.php");
break;
case "home": include("inc/home.php");
break;
case "privacypolicy": include("inc/privacypolicy.php");
break;
}}else{
include("inc/home.php");}

and the content changes depending on the parameter passed

Edited by terabyte: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.