Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin Tips & Tricks

Reply
 
Thread Tools
Use vBCms Widget everywhere
ragtek
Join Date: Mar 2006
Posts: 1,630

 

austria, croatia
Show Printable Version Email this Page Subscription
ragtek ragtek is offline 06-21-2010, 10:00 PM

Here is a method, how to use the widgets on own pages.

1. fix this bug: http://tracker.vbulletin.com/browse/VBIV-7640
2. Now you can use the following code where you want (plugin, own php page):
PHP Code:
bootstrap_framework();
vBCms_View_Widget::registerTemplater(vB_View::OT_XHTML, new vB_Templater_vB());

$widgetID 32// the id of the widget

$widgettype 'Static'// type of the widget you want to output

$widget vBCms_Widget::create('vBCms'$widgettype$widgetID);
$output $widget->getPageView()->render(); 
3. Now the output is saved in the $output variable, which can be placed where you want
Reply With Quote
  #2  
Old 08-29-2010, 12:03 PM
ThorstenA's Avatar
ThorstenA ThorstenA is offline
 
Join Date: Nov 2004
Posts: 669
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Wow, amazing! So with that you could actually use cms widgets (the "real ones") also on the forum home page? Then that would be the solution for integrating the "read widgets" also on the forum sidebar.

And the proprietary sidebar can rest in peace, finally
Reply With Quote
  #3  
Old 08-29-2010, 01:37 PM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yea, it's possible and i wanted to create a add-on for this, but i had some styling problems, so i gave it up.

I'll try it again after the 4.1 release, because the styling will hopefully be easier
Reply With Quote
  #4  
Old 09-21-2010, 03:00 AM
bchertov's Avatar
bchertov bchertov is offline
 
Join Date: Dec 2004
Location: Sonoma County, CA
Posts: 259
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'll be looking for the 4.1 add-on, or better yet VB will implement this!

--------------- Added [DATE]1285041706[/DATE] at [TIME]1285041706[/TIME] ---------------

Can you give a full example of how you would place this on a forum page, including specifying which forum?

Thanks!
Reply With Quote
  #5  
Old 09-21-2010, 04:49 PM
cad2go cad2go is offline
 
Join Date: Feb 2009
Posts: 181
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

brilliant! tagged
Reply With Quote
  #6  
Old 09-30-2010, 11:33 AM
tintin74 tintin74 is offline
 
Join Date: Jul 2007
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello ragtek, I want to call this widget using a template. I've already create a plugin with the code you've suggested. Could you tell me how to include the $output variable into a template? I'm using vb4.0.6

Thank you

--------------- Added [DATE]1285853151[/DATE] at [TIME]1285853151[/TIME] ---------------

Ragtek , you've post on vbulletin.com this code to use like a plugin into vbulletin :
Code:
bootstrap_framework();
vBCms_View_Widget::registerTemplater(vB_View::OT_XHTML, new vB_Templater_vB());
$widgetID = 20; // the id of the widget
$widgettype = 'RecentContent';
$widget = vBCms_Widget::create('vBCms', $widgettype, $widgetID);
$output = $widget->getPageView()->render();
$templater ->register('widget', $output);
Using this

Code:
{vb:raw widget}
into the template to call the plugin .

But If I do it, I get this error :

Fatal error: Call to a member function register() on a non-object in /var/www/vhosts/mydomain.com/httpdocs/new/forum/global.php(29) : eval()'d code on line 8

Do you know how to solve this, please?

Thank you

o
Reply With Quote
  #7  
Old 11-09-2010, 02:03 AM
wottech wottech is offline
 
Join Date: May 2006
Posts: 122
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am also either getting errors, or nothing to appear. Has anyone successfully gotten this to work with Section Navigation?
Reply With Quote
  #8  
Old 01-07-2011, 10:33 AM
wottech wottech is offline
 
Join Date: May 2006
Posts: 122
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Since someone asked about it over on vb.com, I was able to finally get this to work with some success. I used ragtek's code and placed it in a new Forum Block using a PHP content type. My goal was to use the Section Navigator in the forums, so my code looked like this:

Code:
bootstrap_framework();
vBCms_View_Widget::registerTemplater(vB_View::OT_XHTML, new vB_Templater_vB());

$widgetID = 16; // the id of the widget

$widgettype = 'SectionNavExt'; // type of the widget you want to output

$widget = vBCms_Widget::create('vBCms', $widgettype, $widgetID);
$output = $widget->getPageView()->render();
For the template, I made a copy of the normal Section Navigation widget template so that I could edit it for the forums. I also used the "Everywhere Sidebar" mod on here to be able to place the menu on all areas of the site.

Now the bad part... I could never get the CSS to work properly to display the menu the same in the forums as it was displayed in the CMS. It basically was just a bulleted list that wasn't collapsible. If someone figures out that part, then I would definitely use it again.
Reply With Quote
  #9  
Old 01-07-2011, 12:40 PM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You need to add the css files to

I think you need
  • widgets.css
  • vbcms.css


Sorry i've forgotten to add it to the tutorial.
Reply With Quote
  #10  
Old 01-07-2011, 02:09 PM
wottech wottech is offline
 
Join Date: May 2006
Posts: 122
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I tried several different ways to add it, but since the Section Navigation uses script from Yahoo, I couldn't figure out how to get it to call properly. I messed with it for several days and never had any success. Any further input would be great, as I would love to get it up and running properly.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06061 seconds
  • Memory Usage 2,287KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete