Results 1 to 5 of 5

Thread: Include files

  1. #1

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Include files

    Generally in the past I would have one settings file that would hold all my PHP stuff, connection settings, functions, global variables etc.

    Is it best to have one long file like i have been doing, or seperate for connection, vars, functions etc?


    Thanks

  2. #2
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: Include files

    separate. What my work tends to do is we have 1 document for connection, 1 for config (user id, password, ip, etc), and then one file for each purpose of the application.

    Having things in different files allows easier re-usability.

  3. #3

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: Include files

    Thanks!

  4. #4
    Hyperactive Member
    Join Date
    Dec 2006
    Location
    Ubuntu Haters Club
    Posts
    405

    Re: Include files

    I tend to keep mine in one file, normally config.php, and have them in different variables that are easy to understand and add too should you need to, rather than having to trawl through other files updating them.

    PHP Code:
    $database['server'] = "localhost";
    $page['main_name'] = "whatever site";
    $email['from_address'] = "[email protected]"
    Maybe that's just me.
    » Twitter: @rudi_visser : Website: www.rudiv.se «

    If Apple fixes security flaws, they are heralded as proactive. If Microsoft fixes a security flaw, they finally got around to fixing their buggy OS.

  5. #5
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Include files

    I use an ini file. parse_ini_file()
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width