Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

include()

y2kbgy2kbg New
edited January 2007 in Vanilla 1.0 Help
I am working my extension (Friends v. 2.0) I want certain php code to only be run when an option is selected. Currently I have it in a another file in the same directory and use include to add it when needed. I think that the include only gets looked at now if the include statement is run.I have been guessing that using include is faster than putting the entire contents of the file in between the if statement brackets. Is my assumption correct or should it all be in one large .php

Comments

  • Options
    From my experience with programming in many languages, using an include function makes code maintenance a little easier. And it also makes updating easier. For example, in Fortran (and yes, I still code in Fortran), certain configurations may vary from client to client. If you had this information hard-coded, you would have to re-compile and link your programs. Keeping certain variable data in the include file makes your code more flexible and easier to maintain.
  • Options
    technically if you have a few files that are included instead of one huge file it makes the file run faster. I'm kinda too tired to make a long and winded explanation about why this is but believe me, it's easier for both the programmers and php if you have many files instead of one
  • Options
    ok thanks thats good good to know that I am doing this right. OK then it will stay that I will have 3 .php files in my extension.
This discussion has been closed.