limitphp Posted March 31, 2009 Share Posted March 31, 2009 To prevent rewriting alot of code, I have about 7 include files on most of the php pages on my website. Almost all of them are more php code. Is that ok? Will it slow the website down if it becomes a ilttle popular, or will it not make any difference whatsoever? 4 of the main include files are: include("inc_set_root.php"); ....for pages that get mod rewrited.... include("inc_connGreckle.php"); ....about 4 lines..... include("inc_global_functions.php"); ....actually, just one function in there right now...pretty short include("inc_login_script.php"); thanks Quote Link to comment https://forums.phpfreaks.com/topic/151955-solved-is-it-ok-to-have-about-7-include-files-on-your-php-pages/ Share on other sites More sharing options...
Brian W Posted March 31, 2009 Share Posted March 31, 2009 won't slow it down enough to notice... milliseconds maybe. Its well worth the advantages of not having repeat code. Quote Link to comment https://forums.phpfreaks.com/topic/151955-solved-is-it-ok-to-have-about-7-include-files-on-your-php-pages/#findComment-797998 Share on other sites More sharing options...
premiso Posted March 31, 2009 Share Posted March 31, 2009 If it was me, I would include the files in an include file. This way you only have one include to do each page: IE: maininclude.inc.php <?php include("inc_set_root.php"); //....for pages that get mod rewrited.... include("inc_connGreckle.php"); //....about 4 lines..... include("inc_global_functions.php"); //....actually, just one function in there right now...pretty short include("inc_login_script.php"); ?> index.php <?php include('maininclude.inc.php'); // now only 1 line required for each file ?> Quote Link to comment https://forums.phpfreaks.com/topic/151955-solved-is-it-ok-to-have-about-7-include-files-on-your-php-pages/#findComment-798004 Share on other sites More sharing options...
limitphp Posted March 31, 2009 Author Share Posted March 31, 2009 If it was me, I would include the files in an include file. This way you only have one include to do each page: IE: maininclude.inc.php <?php include("inc_set_root.php"); //....for pages that get mod rewrited.... include("inc_connGreckle.php"); //....about 4 lines..... include("inc_global_functions.php"); //....actually, just one function in there right now...pretty short include("inc_login_script.php"); ?> index.php <?php include('maininclude.inc.php'); // now only 1 line required for each file ?> that .inc.php won't mess anything up? the fact that there's a .inc in there? Quote Link to comment https://forums.phpfreaks.com/topic/151955-solved-is-it-ok-to-have-about-7-include-files-on-your-php-pages/#findComment-798011 Share on other sites More sharing options...
premiso Posted March 31, 2009 Share Posted March 31, 2009 No, it will not. The .inc is optional, it is just a naming convention I use. You can have as many periods as you want in a file name, all the name cares about is the last x characters after the . which describe what type of file it is. Quote Link to comment https://forums.phpfreaks.com/topic/151955-solved-is-it-ok-to-have-about-7-include-files-on-your-php-pages/#findComment-798023 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.