PhucSD
12-06-2011, 04:17 PM
Media Library CMS Sidebar
Released 06-06-2010
By Vikas - http://www.ngcoders.com (http://www.ngcoders.com/)
For Plugin - http://www.vbulletin.org/forum/showthread.php?t=240677 (8WayRun.Com - Media Library)
For Demo - http://www.roboticsindia.com/ ( Left Sidebar )
Installation
Goto Admincp->vBullietin CMS->Widgets->Create New Widget
Choose PHP Direct Execution as Widget's Type
Place a Title. eg Latest Videos. 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 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
global $vbulletin;
require_once(DIR.'/media/media_functions_hrefs.php');
// %d
$show_count = 5;
$medias = $vbulletin->db->query_read("
SELECT media.*, media_service.*
FROM " . TABLE_PREFIX . "media AS media
LEFT JOIN " . TABLE_PREFIX . "media_service AS media_service ON(media_service.serviceID = media.serviceID)
ORDER BY media.dateline DESC
LIMIT ".$show_count);
$output = '
<style type="text/css">
.thumbnail img{
width: 90px;
height: 70px;
border: 1px solid #ccc;
padding: 5px;
margin: 5px;
float: left;
}
.video_bit {
min-height: 90px;
}
</style>
';
while ($media = $vbulletin->db->fetch_array($medias))
{
$media['thumbnail'] = $vbulletin->options['media_thumb_dir']."/thumbs/". $media['mediaID'] .".jpg";
$media['href'] = construct_href_details($media);
extract($media);
$title = substr($title,0,60);
$mediabits .= sprintf('<div class="cms_widget_post_bit video_bit"><div class="thumbnail"><a href="%s"><img src="%s"></a></div><div class="cms_widget_post_header"><a href="%s">%s</a></div><div class="cms_widget_post_userinfo"><a href="member.php/u=%d">%s</a> On %s</div></div>',$href,$thumbnail,$href,$title,$userid,$username, date('F j, Y, g:i a',$dateline));
}
$output .= $mediabits;
Released 06-06-2010
By Vikas - http://www.ngcoders.com (http://www.ngcoders.com/)
For Plugin - http://www.vbulletin.org/forum/showthread.php?t=240677 (8WayRun.Com - Media Library)
For Demo - http://www.roboticsindia.com/ ( Left Sidebar )
Installation
Goto Admincp->vBullietin CMS->Widgets->Create New Widget
Choose PHP Direct Execution as Widget's Type
Place a Title. eg Latest Videos. 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 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
global $vbulletin;
require_once(DIR.'/media/media_functions_hrefs.php');
// %d
$show_count = 5;
$medias = $vbulletin->db->query_read("
SELECT media.*, media_service.*
FROM " . TABLE_PREFIX . "media AS media
LEFT JOIN " . TABLE_PREFIX . "media_service AS media_service ON(media_service.serviceID = media.serviceID)
ORDER BY media.dateline DESC
LIMIT ".$show_count);
$output = '
<style type="text/css">
.thumbnail img{
width: 90px;
height: 70px;
border: 1px solid #ccc;
padding: 5px;
margin: 5px;
float: left;
}
.video_bit {
min-height: 90px;
}
</style>
';
while ($media = $vbulletin->db->fetch_array($medias))
{
$media['thumbnail'] = $vbulletin->options['media_thumb_dir']."/thumbs/". $media['mediaID'] .".jpg";
$media['href'] = construct_href_details($media);
extract($media);
$title = substr($title,0,60);
$mediabits .= sprintf('<div class="cms_widget_post_bit video_bit"><div class="thumbnail"><a href="%s"><img src="%s"></a></div><div class="cms_widget_post_header"><a href="%s">%s</a></div><div class="cms_widget_post_userinfo"><a href="member.php/u=%d">%s</a> On %s</div></div>',$href,$thumbnail,$href,$title,$userid,$username, date('F j, Y, g:i a',$dateline));
}
$output .= $mediabits;