hello again,

i have one more problem im trying to get past, i have a url structure like this....

products.php?page=scripts

how would i make a multiple variable so i can also use this....

products.php?pid=sscfa

but not at the same time, either one or the other, i have attached the code for the page below and if anyone has a moment to spare it would be great if you could tweak my code in order to do as stated above, thanks for your time and i look forward to hearing from you guys, this community rocks!

<?

$page = $_GET['page'];

$category = "products";
$template = "resources/templates/$category/$page.php";

//Dynamically Create Page Structure

	include("resources/includes/header.php");

	if (file_exists("$template")) {

		include("$template");

	} else {

	echo("<div class=\"content-box\">");
	echo("<h4>Ooops</h4>");
	echo("<p>Page Not Found</p>");
	echo("</div>");

	}

//End Of Structure Creation

include("resources/includes/footer.php"); 

?>

Nathaniel Blackburn

i think i have come up with something, it seems to do the trick but im not sure if its the correct way of doing it...

<?

$page = $_GET['page'];
$product = $_GET['product'];

$category = "products";
$template = "resources/templates/$category/$page.php";

if ( empty( $page) && empty( $product) ) { 

	include("resources/includes/header.php");
	
	echo("<div class=\"content-box\">");
	echo("<h4>Ooops</h4>");
	echo("<p>Page Not Found</p>");
	echo("</div>");
	
	include("resources/includes/footer.php"); 

} elseif (empty($page)) {

//Dynamically Create Page Structure

	include("resources/includes/header.php");

	if (file_exists("$template")) {

		include("$template");

	} else {

	echo("<div class=\"content-box\">");
	echo("<h4>Ooops</h4>");
	echo("<p>Product Not Found</p>");
	echo("</div>");

	}

	//End Of Structure Creation

	include("resources/includes/footer.php"); 


} elseif (empty($product)) {

//Dynamically Create Page Structure

	include("resources/includes/header.php");

	if (file_exists("$template")) {

		include("$template");

	} else {

	echo("<div class=\"content-box\">");
	echo("<h4>Ooops</h4>");
	echo("<p>Page Not Found</p>");
	echo("</div>");

	}

	//End Of Structure Creation

	include("resources/includes/footer.php"); 

}

?>

Nathaniel Blackburn

i have no idea what im doing now, haha.

im trying to create a dynamic page structure for products but using my existing one so i dont have to create too many pages, i was thinking of using mysql for the products but pages are template based as it works better and is less dangerous than adding php code into mysql.

Nathaniel Blackburn

Adding php code into mysql?? not sure what you mean.

There is actually a PHP forum here, which is where this thread should be. But aside from that, dynamic pages can and do work with databases.

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.