Jump to content

[SOLVED] Include Error


maxudaskin

Recommended Posts

I am having an issue. The error reporting is on, but something is going array. The file exists.

 

<?php
/**
* Display Page
*
* Get's the page includes and sends the information to the index for inclusion.
*
* @author    Max Udaskin <[email protected]>
* @copyright 2008 Max Udaskin
* @license   http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version   $Id: display_page.php 2008-10-26 02:10:00Z
*/

class displayPage
{
function __construct()
{
	/**
	 * @var string $page Contains the current page link
 	*/
	global $includes;
	global $page;
	$page = empty($_GET['p']) ? 'home' : $_GET['p'];

	if($page == 'home' || $page == 'index')
	{
		$GLOBALS['includes'] = array('home.php',
						'configuration/config.php',
						'functions_lib.php',
						'errors.php');
	}
	elseif($page == 'login')
	{
		$GLOBALS['includes'] = array('login.php',
						'configuration/config.php',
						'functions_lib.php',
						'errors.php',
						'login_lib.php');
	}
	elseif($page == 'register')
	{
		$GLOBALS['includes'] = array('register.php',
						'configuration/config.php',
						'functions_lib.php',
						'errors.php',
						'login_lib.php',
						'register_lib.php');
	}
	else
	{
		$GLOBALS['includes'] = array("");
	}
}

/**
 * Get File Includes
 *
 * Retrieves the files to be included in the index page
 */
function includeFiles()
{
	define('ALLOW_ACCESS' , true);
	echo '1';
	$count = count($GLOBALS['includes']);
	echo '2';
	for($i = 1; $i < $count; $i++)
	{
		echo '3';
		if(file_exists('includes/scripts/' . $GLOBALS['includes'][$i]))
		{
			echo '4';
			echo 'includes/scripts/' . $GLOBALS['includes'][$i];
			include ('includes/scripts/' . $GLOBALS['includes'][$i]);
			echo '5';
			echo '<br />';
		}
		else
		{
			echo '6';
			echo "Cannot find file.";
			echo '7';
			echo '<br />';
			//displayError('Cannot include file: ' . $includes[$i]);
		}
	}
}

/**
 * Display Page
 *
 * Includes the page information
 */
 function displayPage()
 {
 	if(file_exists('includes/pages/' . $GLOBALS['includes'][0]))
	{
		include ('includes/pages/' . $GLOBALS['includes'][0]);
	}
	else
	{
		//displayError('Cannot display page: ' . $includes[0]);
	}
	}
}
?>

 

And the front end page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Virtual Air Transat</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<?php
include ('display_page.php');
$displaypage = new displayPage();
$displaypage->includeFiles();
?>
<body>
<div align="center">
<?php
include ('includes/template/header.html') or die ( "cannot include header.");
$displaypage->displayPage();
include ('includes/template/footer.html');
?>
</div>
</body>
</html>

 

Output:

1234includes/scripts/configuration/config.php5

34includes/scripts/functions_lib.php5

34includes/scripts/errors.php

Link to comment
https://forums.phpfreaks.com/topic/130666-solved-include-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.