Jump to content

Recommended Posts

Here's a simple example:

 

Place this code on the first line of your index.php:

<?php
if (empty($_GET['page']))
	{
		$_GET['page'] = 'home';
	}
?>

 

Place this code in your content div:

<?php
			if(is_numeric($_GET['page'])) // check if button ACTION is a number.
				{
					$page = $_GET['page'];
					$query="SELECT * FROM `table_in_database` WHERE `id` = '$page';";
					$result = mysql_query($query);
					$inhoud = mysql_fetch_assoc($result);  // MYSQL data to PHP
					echo $inhoud['info']; // Display your content
				}
			else // if not a number then load page from the PAGES folder.
				{
					$_GET['page'];
					include('pages/'.$_GET['page'].'.php'); // name and add .PHP to it
															// wich will result in a 
															// filename in the PAGES
															// folder.
				}

?>

 

Now, make a folder on the root called pages. In this folder are the files stashed like home.php, news.php , allyourfiles.php etc etc. These will be called from the content div.

 

Your buttons (anywhere on your page) must have the following action:

?page=home

Home is referring to your pages/home.php file.

 

Or get the content out of a dabase:

?page=1

 

If anyone feels the need to add a more complicated one with security feel free to do so but i thought this might be a good way to start.

 

Enjoy.

Link to comment
https://forums.phpfreaks.com/topic/126596-all-in-one/#findComment-656177
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.