Non-executing code affecting program

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
traherom
Forum Newbie
Posts: 13
Joined: Tue Mar 15, 2005 6:43 am

Non-executing code affecting program

Post by traherom »

I have this code:

Code: Select all

<?php
require_once 'includes/user_standard.php';

// Ensure that a page was requested
if(!isset($_GET['page']))
{
	// Assume "default" page
	$pageName = $default_page;
}
else
{
	// Save name for easy use
	$pageName = $_GET['page'];
}

// Get page
$page = getPage($connection, $pageName);
if($page === false)
{
	// Try to get error page
	//$page = getPage($connection, $error_page)
	if($page === false)
	{
		die("An error occured while retrieving page '{$pageName}.'");
	}
}

// Get template
$template = getTemplate($connection, $page['template_name']);
if($template === false)
{
	die("An error occured while retrieving the template " . $page['template_name'] . " for page '{$pageName}.'");
}

// Parse and output
echo parseTemplate($connection, $template, $page);
?>
The problem is that if I uncomment the call to getPage for the error page (line 21), I get no output at all, even if I request a valid page. I've tried uncommenting the call and throwing an echo at the top of the php and still get nothing. I'm have no clue why this happens; that section of code isn't even executing... :rolleyes:

Thanks in advance for any ideas.

--EDIT--
Here's what a normal page would look like:

Code: Select all

&lt;!-- Include of template header --&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;&lt;!-- Begin substitution title --&gt;Main page&lt;!-- End substitution --&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body style='margin: 0px; padding 0px;'&gt;
&lt;div style='width=100%; height: 50px; left: 0px; top: 0px; background-color: #FF0000; color: #00FF00;'&gt;
&lt;!-- Begin substitution title --&gt;Main page&lt;!-- End substitution --&gt;
&lt;/div&gt;
&lt;div style='width=100%; top: 50px; left: 0px; background-color: #0000FF; color: #FF00FF;'&gt;
&lt;!-- End include --&gt;


&lt;h1&gt;&lt;!-- Begin substitution title --&gt;Main page&lt;!-- End substitution --&gt;&lt;/h1&gt;
&lt;p&gt;&lt;!-- Begin substitution content --&gt;This is the main page of this site. It's obviously extremely pre-alpha. :)&lt;!-- End substitution --&gt;&lt;/p&gt;

&lt;!-- Include of template footer --&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;!-- End include --&gt;
Obviously... the color's aren't really real. I was just messing around making sure things worked. :)

And here's what a non-existent page error returns (with the attempt to retrieve the error page commented out, as above)

Code: Select all

An error occured while retrieving page 'asdf.'
Post Reply