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.

Recommended Answers

All 3 Replies

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

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

Thanks Terabyte. That's helped me alot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.