Multifile Modules


Most PHP-Nuke modules, then, do all of their work from within a single PHP file. The file is set up with multiple functions to handle different operations. The Sections module, for example, can display a section list, display individual articles, and so forth; this is all accomplished by having multiple functions in one file named modules/Sections/index.php.

But what if you want to use multiple files in a module? You can. Addon_Sample actually demonstrates this by including a second file, named f2.php. To link to this file, you use something like modules.php?name=Addon_Sample&file=f2. If the f2.php file contains multiple functions, you can use something like modules.php?name=Addon_ Sample&file=f2&func=whatever to specify the specific function you want; f2.php would need to contain a switch($func) construct to evaluate the &func" portion of the URL and execute the appropriate function within the file.



    PHP-Nuke Garage
    PHP-Nuke Garage
    ISBN: 0131855166
    EAN: 2147483647
    Year: 2006
    Pages: 235
    Authors: Don Jones

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net