View Full Version : Widgets/Modules
stledger
09-24-2012, 07:03 PM
Anyone found out how to create widgets yet? I haven't really had much chance to look around and find out how, I imagine it's like a template thats within the widget?
nhawk
09-25-2012, 09:27 AM
Widgets are a part of products. And there are different types of widgets.
The way I've been creating them is to manually add them into the <widget> section of the product install XML.
In the sample below, a PHP widget would be created with 2 fields. One field is the title for the widget, the other contains PHP Code...
<widget>
<title>New Widget</title>
<template>widget_15</template>
<admintemplate />
<category>Display</category>
<icon>module-icon-php.png</icon>
<cloneable>0</cloneable>
<guid>myproduct-widget_15-UNIQUE_ID_NUMBER_GOES_HERE</guid>
<definitions>
<definition>
<name>title</name>
<label>Title</label>
<field>Text</field>
<isrequired>1</isrequired>
<isusereditable>0</isusereditable>
<displayorder>1</displayorder>
<validationtype>force_datatype</validationtype>
<validationmethod />
<defaultvalue>New Widget</defaultvalue>
</definition>
<definition>
<name>code</name>
<label>PHP Code</label>
<field>LongText</field>
<isrequired>0</isrequired>
<isusereditable>1</isusereditable>
<displayorder>2</displayorder>
<validationtype>force_datatype</validationtype>
<validationmethod />
<defaultvalue>echo 'Hello';</defaultvalue>
</definition>
</definitions>
</widget>
A completely custom widget is done in much the same way, except you specify your own template, etc. and the fields can be whatever you want them to be.
Badshah93
09-25-2012, 04:24 PM
If you have experience of creating widgets for cms, then it will be very easy to create widget/module for vB5.
You can pull fetch_rows (ex: for latest threads) by creating a class in core/vb/api folder and then by using
{vb:data variable_name, classname, function_name, arguments)
Then {vb:each} will be use for printing each row.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.