The architecture for an application I created for a client required a method to auto-load a set of widgets (aka: individual PHP scripts) located in the “widgets” directory on the server. ┬áThis solution worked perfectly.

Of course, you can enhance this script by refactoring it into a function and adding additional filters to allow only certain types of files to load, like those prefixed with “widget-“.

Leave a Reply

Your email address will not be published. Required fields are marked *