@bizzar528:
Totally agree with your idea and solution of selfmade framework. I call this central file index.php "engine". Additionally I use a selfmade MVC approach in combination with the engine:
- index.php (engine, all pages are generated here, all actions are processed here,
my engine does caching and handles multi-language support, checks if requested controller exists and includes it)
|
+---- _functions.php (root, always included from index.php)
+---- _config.php (root, always included from index.php)
+---- _style.css (root, because only one file and often edited, so no time wasted to change folder)
+---- /_Controller (subfolder - here goes all actions like: index.php?action=contact )
e.g. _Controller/contact.php, e.g. a typical controller looks like this two liner:
include "_Model/contact.php"
include "_View/contact.php"
The controller includes one or more model and view files or other controllers
+---- /_Model (subfolder - here goes all data like static arrays,
database routines to get data, CSV files holding data
... all data files or getter functions or data in general - all are called $data)
+---- /_View (all presentation files, converts $data with foreach loops to HTML, like Templates)
Models and Views can be reused again and again by different Controllers. Complex pages can be easily built by including controllers in a controller. A standard variable is $block. All views are returning $block to the controller. A page is built by one or more blocks. The entire page is cached. The page name is identical with the controller name. The engine checks if a cached file for this controller exists and loads it. If no cache file exists, the controller is included, page is generated and written to subfolder /_Cache. Next time the cached file is called (faster).
Addionally an Apache .htaccess file is in the root to speed up page load by automatically compression (deflate/gzip) all files with about 80% reduction of file size to be transfered, deactivating Etag, caching images and CSS files for revisiting pages.
Hope this is helpful.
[/] LinkMatrix.de 3315 Open Education Search Download