Advice with a class to load modules please?
Hello. I'm after some help please. I'm trying to build a framework to maintain my website structure.
On my website my layout consists of a main frame and a right hand menu.
In the right hand menu I have things like
* a most read box
* a contact me graphic
* a social media box
In my framework I'm thinking how I can load each of them in, so I thought of renaming the files and putting them in their own .php file
Then calling them in like so on the pages I need them
Are they class files or procedural files?
Just procedural. Thank you
That looks to be a fairly reasonable idea overall then. You may want to double check that everything in the array is a file that's readable (maybe even check that its in a place you're allowing to be read from), then provide it as an argument.
An alternative is to use a single entry point, and provide querystring information regarding it. That's probably more along what I'd do, simply to save on processing files. I typically build lots and lots of classes, but only one executable file with only a few lines of code. Too bad PHP doesn't have a class entry point.
If these were classes, than the better approach is to use autoloading with registered extensions. That's a simple matter of adding an include path, and registering the extension (which is why I always suggest .class.php as your php class files and interfaces). Then it's automatically discovered in the include path and included on invocation of new:
|All times are GMT +1. The time now is 09:44 AM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.