Jump to content

[SOLVED] Is it ok to have about 7 include files on your php pages?


Recommended Posts

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

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
?>

 

:)

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?

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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