maxudaskin Posted October 30, 2008 Share Posted October 30, 2008 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/130668-solved-include-error/ Share on other sites More sharing options...
dezkit Posted October 30, 2008 Share Posted October 30, 2008 Great, can we get what the problem is? Link to comment https://forums.phpfreaks.com/topic/130668-solved-include-error/#findComment-678056 Share on other sites More sharing options...
maxudaskin Posted October 30, 2008 Author Share Posted October 30, 2008 There is no output after the last include. I should have written that, instead of expecting you to realize that. Sorry. Link to comment https://forums.phpfreaks.com/topic/130668-solved-include-error/#findComment-678058 Share on other sites More sharing options...
maxudaskin Posted October 30, 2008 Author Share Posted October 30, 2008 I know that bumping is very annoying, but I am stuck right now. If I add an or die ('Process Killed') statement after the include, I get, but the rest of the script continues: 1234includes/scripts/configuration/config.php Warning: displayPage::include(1) [function.displayPage-include]: failed to open stream: No such file or directory in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Virtual Air Transat\display_page.php on line 72 Warning: displayPage::include() [function.include]: Failed opening '1' for inclusion (include_path='.;C:\Program Files\PHP\pear;C:\Program Files\Zend\Core\ZendFramework-0.8.0') in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Virtual Air Transat\display_page.php on line 72 5 34includes/scripts/functions_lib.php Warning: displayPage::include(1) [function.displayPage-include]: failed to open stream: No such file or directory in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Virtual Air Transat\display_page.php on line 72 Warning: displayPage::include() [function.include]: Failed opening '1' for inclusion (include_path='.;C:\Program Files\PHP\pear;C:\Program Files\Zend\Core\ZendFramework-0.8.0') in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Virtual Air Transat\display_page.php on line 72 5 34includes/scripts/errors.php Warning: displayPage::include(1) [function.displayPage-include]: failed to open stream: No such file or directory in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Virtual Air Transat\display_page.php on line 72 Warning: displayPage::include() [function.include]: Failed opening '1' for inclusion (include_path='.;C:\Program Files\PHP\pear;C:\Program Files\Zend\Core\ZendFramework-0.8.0') in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Virtual Air Transat\display_page.php on line 72 5 Warning: include(1) [function.include]: failed to open stream: No such file or directory in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Virtual Air Transat\index.php on line 16 Warning: include() [function.include]: Failed opening '1' for inclusion (include_path='.;C:\Program Files\PHP\pear;C:\Program Files\Zend\Core\ZendFramework-0.8.0') in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Virtual Air Transat\index.php on line 16 Link to comment https://forums.phpfreaks.com/topic/130668-solved-include-error/#findComment-678107 Share on other sites More sharing options...
maxudaskin Posted October 30, 2008 Author Share Posted October 30, 2008 I accidentally mis-spelled a constant in another page. <?php if(!defined('ALLOW_ACCESS')) { exit; } ?> Link to comment https://forums.phpfreaks.com/topic/130668-solved-include-error/#findComment-678129 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.