n1kko Posted November 5, 2011 Share Posted November 5, 2011 File will not include, have I missed something? Thanks if ($arrPage['include']===false) { if (function_exists($arrPage['function_name'])) { call_user_func($arrPage['function_name']); } else if ($arrPage['function_name']!='') { echo '<div id="page">'; alert_box('Function not found', 'The function '.$arrPage['function_name'].' does not appear to exist. Please check with the plugin author.'); echo '</div>'; } } else { $includePath = dirname('$url').'/'.$arrPage['include']; if (file_exists($includePath)) { include_once($includePath); if (function_exists($arrPage['function_name'])) { call_user_func($arrPage['function_name']); } else if ($arrPage['function_name']!='') Quote Link to comment https://forums.phpfreaks.com/topic/250532-whats-wrong-file-will-not-include/ Share on other sites More sharing options...
xyph Posted November 5, 2011 Share Posted November 5, 2011 You've missed pointing out any error messages you're getting. You've also probably missed verifying that the variables contain what you expect the to contain. Quote Link to comment https://forums.phpfreaks.com/topic/250532-whats-wrong-file-will-not-include/#findComment-1285356 Share on other sites More sharing options...
n1kko Posted November 5, 2011 Author Share Posted November 5, 2011 Thanks, I cant seem to get any errors to show up. Quote Link to comment https://forums.phpfreaks.com/topic/250532-whats-wrong-file-will-not-include/#findComment-1285359 Share on other sites More sharing options...
n1kko Posted November 5, 2011 Author Share Posted November 5, 2011 this is all i see File ./admin-dashboard.inc.php not found for inclusion Quote Link to comment https://forums.phpfreaks.com/topic/250532-whats-wrong-file-will-not-include/#findComment-1285360 Share on other sites More sharing options...
Pikachu2000 Posted November 5, 2011 Share Posted November 5, 2011 There's nothing in the above code that would return that error message. Quote Link to comment https://forums.phpfreaks.com/topic/250532-whats-wrong-file-will-not-include/#findComment-1285361 Share on other sites More sharing options...
n1kko Posted November 7, 2011 Author Share Posted November 7, 2011 I'm no coder and not sure what should replace the path $includePath = dirname('/Applications/XAMPP/xamppfiles/htdocs/folder/admin/index.php').'/'.$arrPage['include']; Thanks Quote Link to comment https://forums.phpfreaks.com/topic/250532-whats-wrong-file-will-not-include/#findComment-1285820 Share on other sites More sharing options...
AyKay47 Posted November 7, 2011 Share Posted November 7, 2011 you will want the relative path to your file.. from within the www directory Quote Link to comment https://forums.phpfreaks.com/topic/250532-whats-wrong-file-will-not-include/#findComment-1285825 Share on other sites More sharing options...
n1kko Posted November 7, 2011 Author Share Posted November 7, 2011 I need it to include multiple files and not sure how to do it? Quote Link to comment https://forums.phpfreaks.com/topic/250532-whats-wrong-file-will-not-include/#findComment-1285841 Share on other sites More sharing options...
n1kko Posted November 7, 2011 Author Share Posted November 7, 2011 This is all of the code, just need the bit "WHAT GOES HERE" if ($arrPage['include']===false) { if (function_exists($arrPage['function_name'])) { call_user_func($arrPage['function_name']); } else if ($arrPage['function_name']!='') { echo '<div id="page">'; alert_box('Function not found', 'The function '.$arrPage['function_name'].' does not appear to exist. Please check with the plugin author.'); echo '</div>'; } } else { $includePath = dirname('WHAT GOES HERE').'/'.$arrPage['include']; if (file_exists($includePath)) { include_once($includePath); if (function_exists($arrPage['function_name'])) { call_user_func($arrPage['function_name']); } else if ($arrPage['function_name']!='') { echo '<div id="page">'; alert_box('Function not found', 'The function '.$arrPage['function_name'].' does not appear to exist after including the file '.$arrPage['include'].'. Please check with the plugin author.'); echo '</div>'; Quote Link to comment https://forums.phpfreaks.com/topic/250532-whats-wrong-file-will-not-include/#findComment-1285848 Share on other sites More sharing options...
cyberRobot Posted November 7, 2011 Share Posted November 7, 2011 Instead of using dirname(), have you tried using $_SERVER['DOCUMENT_ROOT']? For example: <?php $includePath = $_SERVER['DOCUMENT_ROOT'] . '/' . $arrPage['include']; ?> Quote Link to comment https://forums.phpfreaks.com/topic/250532-whats-wrong-file-will-not-include/#findComment-1285854 Share on other sites More sharing options...
n1kko Posted November 7, 2011 Author Share Posted November 7, 2011 Thanks tried that but does not work Quote Link to comment https://forums.phpfreaks.com/topic/250532-whats-wrong-file-will-not-include/#findComment-1285855 Share on other sites More sharing options...
cyberRobot Posted November 7, 2011 Share Posted November 7, 2011 Thanks tried that but does not work Are you getting an error? Quote Link to comment https://forums.phpfreaks.com/topic/250532-whats-wrong-file-will-not-include/#findComment-1285856 Share on other sites More sharing options...
n1kko Posted November 7, 2011 Author Share Posted November 7, 2011 Just get this message in the admin File /Applications/XAMPP/xamppfiles/htdocs/admin-dashboard.inc.php not found for inclusion. and same for all other pages... File /Applications/XAMPP/xamppfiles/htdocs/admin-options-init.inc.php not found for inclusion. Quote Link to comment https://forums.phpfreaks.com/topic/250532-whats-wrong-file-will-not-include/#findComment-1285857 Share on other sites More sharing options...
n1kko Posted November 7, 2011 Author Share Posted November 7, 2011 If it is set to this /Applications/XAMPP/xamppfiles/htdocs/folder/admin/index.php It works but no good if installs on another server without manually changing Quote Link to comment https://forums.phpfreaks.com/topic/250532-whats-wrong-file-will-not-include/#findComment-1285858 Share on other sites More sharing options...
Pikachu2000 Posted November 7, 2011 Share Posted November 7, 2011 As I already stated: There's nothing in the above code that would return that error message. Threads merged. Don't double post. Quote Link to comment https://forums.phpfreaks.com/topic/250532-whats-wrong-file-will-not-include/#findComment-1285859 Share on other sites More sharing options...
n1kko Posted November 7, 2011 Author Share Posted November 7, 2011 Sorry Quote Link to comment https://forums.phpfreaks.com/topic/250532-whats-wrong-file-will-not-include/#findComment-1285862 Share on other sites More sharing options...
n1kko Posted November 7, 2011 Author Share Posted November 7, 2011 SOLVED with this $includePath = dirname('./admin/admin.php').'/'.$arrPage['include']; Thanks Guys for all your help. Quote Link to comment https://forums.phpfreaks.com/topic/250532-whats-wrong-file-will-not-include/#findComment-1285863 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.