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']!='') 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. 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. 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 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. 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 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 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? 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>'; 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']; ?> 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 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? 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. 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 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. 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 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. 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
Archived
This topic is now archived and is closed to further replies.