* Goto Admincp->vBulletin CMS->Widgets->Create New Widget
* Choose PHP Direct Execution as Widget’s Type
* Place a Title. eg Most Rescent (x). Keep it short as this is what will appear as title on your pages.
* Click Save
* Click Configure on the right of the new created widget.
* Remove the default code that appears. Be sure to not leave behind even a single letter.
* Copy and Paste the php code that you can find below.
* Leave the template name as is (vbcms_widget_execphp_page)
* Click Save
* Goto Admincp->vBullietin CMS->Layout Manager
* Click Go on the Default Layout
* Add the Widget to your Layout
* Click Save
* That’s all !!
PHP Code:
[CODE]
ob_start();
$widget_cut_title = 30; // Cutting the Number of Characters
$widget_results = 6; // Number of Results
$widget_row = 3; //Example 4 or 3 or 2
$widget_percent = ‘33%’; //Example 25% or 33% or 50%
$widget_vbtube_dbquery = ” WHERE active=1 and tube=” AND mediatype=’video’ ORDER BY joindate DESC “;
require_once(‘./vbtube_functions.php’);
$leer=0;
// Get Popular Threads
$popular_get = vB::$db->query_read(“
SELECT tubeid,title,link1img,rating FROM “.TABLE_PREFIX.”vbtube_tubes
$widget_vbtube_dbquery
LIMIT $widget_results”);
$output_bits = ‘
‘;
while($popular = vB::$db->fetch_array($popular_get))
{
$leer++;
$popularlink=vbtube_link($vbulletin->options[‘vbtube_seopower’],$popular[title],$popular[tubeid]);
$popular[‘title_cut’]=vbtube_cut_text($popular[‘title’],$widget_cut_title);
$popular[‘tubes_ratesymbol’]=vbtube_rate($popular[‘rating’]);
$output_bits .= “
“;
if($leer % $widget_row == 0) $output_bits .= “
}
$output = “
“;
ob_end_clean(); [/CODE]
Change these Values if needed:
PHP Code:
[CODE]
$widget_cut_title = 30; // Cutting the Number of Characters
$widget_results = 6; // Number of Results
$widget_row = 3; //Example 4 or 3 or 2
$widget_percent = ‘33%’; //Example 25% or 33% or 50%
$widget_vbtube_dbquery = ” WHERE active=1 and tube=” AND mediatype=’video’ ORDER BY joindate DESC “;
[/CODE]
Extra dbqueries:
Create a new Widget with same PHP Code above except $widget_vbtube_dbquery Variable.
Add one of the variables below.
Best Rated:
$widget_vbtube_dbquery = ” WHERE active=1 AND tube=” AND mediatype=’video’ ORDER BY rating DESC “;
Most Viewed:
$widget_vbtube_dbquery = ” WHERE active=1 AND tube=” AND mediatype=’video’ ORDER BY views DESC “;
Most Voted:
$widget_vbtube_dbquery = ” WHERE active=1 AND tube=” AND mediatype=’video’ ORDER BY votes DESC “;
Random:
$widget_vbtube_dbquery = ” WHERE active=1 AND tube=” AND mediatype=’video’ ORDER BY rand() “;
Recent Videos from CategoryID 2:
$widget_vbtube_dbquery = ” WHERE categoryid = 2 AND active=1 AND tube=” AND mediatype=’video’ ORDER BY joindate DESC “;