PDA

View Full Version : [bd] WIdget Framework v1.0.3



s0ct0j0c
21-04-2011, 07:42 AM
Widget Framework
People love widgets

[INSTALLATION]
1. Upload files and directories inside `upload` to XenForo's root directory. Select "Merge" for everything if you are asked
2. Import the .xml file using XenForo addon importer
3. Enjoy

[WIDGETS]
Currently, the addon is packed with the following widgets:
1. Staff Online Now
2. Members Online Now
3. Forum Statistics
4. Share
5. Clear Sidebar
6. Users. 2 modes: order by register_date or message_count
7. Threads. 4 modes: New threads, Recent threads, Popular threads or all of them (tabbed interface)
8. Conditional HTML. Test a PHP expression and display HTML on sidebar

[WHY A FRAMEWORK?]
I have seen many people releasing sidebar related addon on xenforo.com. The idea is the same: adding something to a page's sidebar. With the hook, developer can easily modify XenForo's sidebar, no big deal. The problem is each developer prefers a different way to do the job and forums administrator will have difficulties to manage all the stuff on their sidebar. With this framework, that problem is gone. Adminsitrator can manage all the widgets in one place, temporary disable one widget is simple as a click. The order can also be changed (well, not support drag and drop yet, sorry for that).

Also, anyone who wants to develop widget to use with the framework can do it in just a few steps. The framework will take care of everything and developers only need to focus on getting the business done. There are 2 things to do: listen to code event "widget_framework_ready", push your class name in to the array to register your widget renderer. After doing so, you can start coding your renderer by extending the base class "WidgetFramework_WidgetRenderer"

PHP:
class MyWidget_WidgetA extends WidgetFramework_WidgetRenderer {
}

There are some abstract methods you will have to implement to make it work, just dig into the code and figure it out. If you got lost, feel free to contact me: pony@xfrocks.com

One last thing, the framework really care about performance. In perfect conditions, no matter how many widgets you have, the framework only execute 1 additional query. I tried to cache as much as possible. The widget list is stored in XenForo's simple cache system while the rendered widgets are stored with Data Registry. Each renderer doesn't have to handle caching, the framework does that for all widgets. All templates are preloaded with the main page template also. Headache no more http://xenforomods.info/styles/default/xenforo/smilies/wink.png

[B]Version 1.0.7, 17-04-2011
- Added option to hide visitor panel in the Empty widget
- Added option to show polls in the Threads widget
- Added "random" group feature
- Added Visitor Panel widget
- Removed other add-on widgets
- Changed Share widget to Share This Page. It can now be used with any position

http://upload.itvnn.net/files/007_conditional.png

http://upload.itvnn.net/files/006_conditional.png