Hi I'm trying to design something from the ground up, using several php sources as inspirations (as indicated by the TPL suffixes). I can't get it to work so please if you could indicate what I'm doing wrong here:

	if (!isset($_GET['page'])) 
		$page = "news.php";
		include ($page);
	} else {
		$page = $_GET['page'];
		if ($page != 'news') {
			include ('header.tpl');
			include ($page.'.html');
			include ('footer.tpl');
		else {
			include ('news.php');

Basically I want to display news.php if there is no URL variable and/or if the URL variable is not given. Otherwise pick up and construct the site by adding up the includes that are shown (header + content + footer).

6 Years
Discussion Span
Last Post by nimchip

Nevermind, I figured out what was wrong. I needed to pass the variables with "page" in the URL, not by simply doing index.php?variable (index.php?page=variable should be used so that it works with this snippet).

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.