![]() |
Autoload classes?
How do you auto include all the classes from a particular folder?
|
PHP Code:
Found here: http://se2.php.net/autoload EDIT: Opps, that was for swe... well w.e you get the point.. |
Will this magic function search through all the directories from where I add this function?
|
No, the magic
autoload function works like so:
In daz's example, if your class is called members then the file name that contains your class must be called members.php. Use glob if you want to include all your class files on-the-fly. But autoload is the preferred method as what's the point of loading in all your class files from the word go if you're not going to use them on that page?PHP Code:
|
Thanks mate.
|
Wildhoney, I've always wondered this but never asked. What does the sz stand for in the variable names? I always see you using this?
|
Quote:
INT - $iNumber STRING - $szWord ARRAY - $aArray There's are some more.. like objects and booleans, etc.. I think there was a thread about this, but anyways.. there's the answer to your question anyhow :-) |
I made a function for this a while back for a project I was doing. You define each of your classes, and you can select them through the function.
PHP Code:
PHP Code:
|
| All times are GMT. The time now is 08:55 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0