hello fellow developers,

i have built my website, how it works is it includes the header and footer through php and the rest of the content is in its corresponding file, but would it be possble to have the rest of the content in a mysql database and create pages like that dynamically (kind of like wordpress does), and if someone has a spare moment could you show me how this is done?

<? include("header.php"); ?>

--main content goes here

<? include("footer.php"); ?>

Website: http://www.shadowscape.co.uk


Nathaniel Blackburn

just select the main content from a table and show it


$page = "myPage"; 

and for showPage.php

	$db = new PDO("mysql:host=$host;dbname=$database", $dbUser, $dbUserPasswod);
	$query = "SELECT TXT FROM pages WHERE page = ?";
	$statement = $db->prepare($query);
		$error = $statement->errorInfo();
		throw new Exception($error[2],(int)$error[0]);
	$result = $statement->fetchAll(PDO::FETCH_ASSOC);
          echo $result[0]["TXT"];


But even this is a hybrid of procedural and OOP …. Have ever consider to move just to OOP ?

Thanks for your help, i managed to make my own navigation system

Nathaniel Blackburn