Question about require_once()

I'm coding a file that will need to include all files in a folder, where they will be added all the time, and I don't want to have to constantly be editing it. Is this a valid line of code?

require_once("*.class");

Can I include *.class so that it will include all the files in that folder? Just curious, otherwise I'll have to find another way around it.

Thanks,
-Darius.
[hr]
[red]require[/red]("[blue]darius.php[/blue]")

Comments

  • about require_once:
    http://nl2.php.net/manual/en/function.require-once.php

    I don't think include * is possible so you should define every include for every file you want to include.

    you could do the following to ease things up...

    make an eeh init.inc and put all your includes IN just another include. If you want to include 5 files on every page it would be ridiculous to actually have them included in every page by pagespecific code.

    I have the same "problem" but i work around by using a "masterinclude" that includes other classes and does some initialisation.

    my very generic init.inc

    [code]
    <?php
    session_start();

    include 'constant.inc.php'; // Include some global configuration variables
    include 'function.inc'; // Include some standard functions

    include 'dbx.inc'; // Include the DataBase-eXchange class
    include 'fpack.inc'; // Include the FilterPACKage class
    include 'auth.inc'; // Include the AUTHentication class

    $shared = New DBX($DBSERVER, $DBUSER, $DBPASSWORD, "shared");
    $DBX = New DBX($DBSERVER, $DBUSER, $DBPASSWORD, $DBNAME);
    $fpack = New fpack($shared);
    $auth = New auth($DBX,$shared);

    $usr = $auth->getUser('');
    $page = $auth->getPage('');
    ?>
    [/code]

    but hey, i have a default header too. so init.inc is not directly included from the pages but from header.inc. Header.inc IS the only file being included in the page files.


    goooodluck


    : I'm coding a file that will need to include all files in a folder, where they will be added all the time, and I don't want to have to constantly be editing it. Is this a valid line of code?
    :
    : require_once("*.class");
    :
    : Can I include *.class so that it will include all the files in that folder? Just curious, otherwise I'll have to find another way around it.
    :
    : Thanks,
    : -Darius.
    : [hr]
    : [red]require[/red]("[blue]darius.php[/blue]")
    :

    [size=5][italic][blue]Dar[RED]Q[/RED][/blue][/italic][/size]
    url--> http://mark.space.servehttp.com

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion