[This is a blog post by Evan Winslow]
One of the big refactors that we've been working on in Elgg 1.8 involves autoloading classes rather than explicitly including them every time the Elgg engine is loaded. This has two primary intended benefits.
1. Increased code cleanliness and organization
Before, your best guess was as good as mine if you wanted to know where the source code for the Friendable interface was. Now, it's a no-brainer: /engine/classes/Friendable.php. All classes and interfaces in Elgg core are organized like this as of Elgg 1.8 in order for the autoloader to work correctly. This makes the Elgg core far more navigable and approachable since the organization is predictable and intuitive.
2. Ease of development
As with virutally every other feature of Elgg, this autoloading functionality will be offered to plugins. It will work similar to the views system: put your new classes in a /classes/ subdirectory in your plugin and Elgg will automatically recognize them as autoload-able. (Note that, unlike views, core classes cannot be overridden using this method!). We hope that this will encourage better plugin organization and speed up development by reducing the amount of "boilerplate" code you have to write in order to get off the ground.
We hope you enjoyed this sneak peek of Elgg 1.8! We'll be posting more updates as we approach the release, so check back often!
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
trying with 1.8, to manage javascript, expecially $(document).ready(function () { and where they are, start to be more complicated than 1.7
in elgg 1.7 there is a lot of inline functions like this for topbar
$(function() {
$('ul.topbardropdownmenu').elgg_topbardropdownmenu();
I see there is now also location for js (head). does this mean we can move js at the bottom? ...seems not.
Yes, you can move js to the footer with Elgg 1.8 (when it is released).
Yes, we are pulling out a lot of the JavaScript that is sprinkled throughout the code into the core JS module.
Yes, what you posted has nothing to do with autoloading classes (the topic of the original post).