vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   vBulletin CMS Widgets - Media Library CMS Sidebar (https://vborg.vbsupport.ru/showthread.php?t=244058)

ngcoders 06-05-2010 10:00 PM

Media Library CMS Sidebar
 
1 Attachment(s)
Media Library CMS Sidebar

Released 06-06-2010
By Vikas - http://www.ngcoders.com
For Plugin - https://vborg.vbsupport.ru/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

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


Xencored 06-06-2010 11:42 AM

Hey mate i think its best if you change the title to CMS sidebar
Jaxel added a forums sidebar one in his mods page (just not a CMS one) i think it will be easyer for people to find
Good Work too :up::up:

rotor 06-06-2010 12:55 PM

Been waiting for this..... thx much appreciated :up: :D

ngcoders 06-06-2010 01:30 PM

Changed to CMS side bar.

schlottkej 06-06-2010 03:04 PM

Where is the Forums Sidebar version in his thread?

schlottkej 06-06-2010 03:47 PM

Wow.. I found it... Ill repost

# NEW FEATURE: Widget support for both the ForumHome Sidebar and the vbCMS.

This has been updated since the previous versions, so please update your codes.

Sidebar Block:
Code:

PHP Code:

global $vbulletin;
    require_once(
DIR.'/media/media_functions_hrefs.php');

    
$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 3
    "
);

    while (
$media $vbulletin->db->fetch_array($medias))
    {
        if (
$media['length'] == 0)
        {
            
$media['length'] = "???";
        }
        else
        {
            
$duration $media['length'];
            
$minutes floor($duration 60);
            
$seconds $duration 60;
            
$seconds str_pad($seconds2"0"STR_PAD_LEFT); 
            
$media['length'] = "$minutes:$seconds";
        }

        
$media['intrate'] = intval($media['rating']);
        
$media['thumbnail'] = $vbulletin->options['media_thumb_dir']."/thumbs/"$media['mediaID'] .".jpg";
        
$media['href'] = construct_href_details($media);

        
$templater vB_Template::create('8WR_media_WIDGET');
            
$templater->register('media'$media);
        
$mediabits .= $templater->render();
    }

    return 
$mediabits

CMS Widget:
Code:

PHP Code:

 require_once(DIR.'/media/media_functions_hrefs.php');

    
$medias vB::$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 3
    "
);

    while (
$media vB::$vbulletin->db->fetch_array($medias))
    {
        if (
$media['length'] == 0)
        {
            
$media['length'] = "???";
        }
        else
        {
            
$duration $media['length'];
            
$minutes floor($duration 60);
            
$seconds $duration 60;
            
$seconds str_pad($seconds2"0"STR_PAD_LEFT); 
            
$media['length'] = "$minutes:$seconds";
        }

        
$media['intrate'] = intval($media['rating']);
        
$media['thumbnail'] = vB::$vbulletin->options['media_thumb_dir']."/thumbs/"$media['mediaID'] .".jpg";
        
$media['href'] = construct_href_details($media);

        
$templater vB_Template::create('8WR_media_WIDGET');
            
$templater->register('media'$media);
        
$mediabits .= $templater->render();
    }

    
$output $mediabits;

# BUG FIX: Fixed formatting buttons on quick reply for comments.
# BUG FIX: Fixed MySQLi errors for those who happen to be using it.
# BUG FIX: Fixed service constructs for non-SEO slugged links.
# BUG FIX: Fixed RSS feeds for tags in table prefix settings. 


nomoreturn 06-06-2010 11:18 PM

1 Attachment(s)
Installed but didnt got the thumbnil of videos

akxt660 06-15-2010 09:22 PM

Have a way to add the userinfo bellow off any midia?

Reef Man 06-28-2010 07:03 PM

do you know how I can configure this on a vbadvanced block?

LouisB 06-29-2010 01:15 PM

Sidebar block works great. Thanks.


All times are GMT. The time now is 12:35 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01271 seconds
  • Memory Usage 1,787KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete