Introduction To Function Libraries.
If you take a look in the VConsole file hierarchy, you will see the folder vconsole/functions/. This folder contains all your function libraries. The purpose for function libraries is to be able to create a list of functions and not have them available until you need them. This makes sure that the software runs at optimal speed. Function libraries also serve the purpose of categorizing your functions so that you can easily edit them, find them, etc... OK, so how does this work? Well, if you look at the vconsole/functions/ folder, you can see that by default, it contains a common folder and a php4 folder. Each of these folders is a function library and each contains 1 or more files. Each file in the function library folder should contain a single PHP function. This makes it easy to find and maintain your functions. You can create your own function libraries by simply creating a new folder under the vconsole/functions/ folder.
Creating Your Own Function Libraries.
You create a new function library by creating a new folder under the vconsole/functions/ folder. You should then create 1 or more php files, each with a function and save them to this new folder. Now, you can make every function in that folder available by calling a single built in VConsole PHP function. (See below)
Making Your Function Library Available.
If you want to make your function library available, that is include all the PHP files from your library folder, you don't need to require them 1 by 1, instead, you can call a single built in VConsole function to make your library available.
Set $folder to the name of the folder for your function library. So if you have created a function library at vconsole/functions/mylibrary/, then you can make all functions in that folder available by calling:
require_library('mylibrary');
There are no comments at this time.