vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin Tips & Tricks (https://vborg.vbsupport.ru/forumdisplay.php?f=239)
-   -   Use vBCms Widget everywhere (https://vborg.vbsupport.ru/showthread.php?t=245074)

ragtek 06-21-2010 10:00 PM

Use vBCms Widget everywhere
 
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:)

ThorstenA 08-29-2010 12:03 PM

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 :)

ragtek 08-29-2010 01:37 PM

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;)

bchertov 09-21-2010 03:00 AM

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!

cad2go 09-21-2010 04:49 PM

brilliant! tagged

tintin74 09-30-2010 11:33 AM

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

wottech 11-09-2010 02:03 AM

I am also either getting errors, or nothing to appear. Has anyone successfully gotten this to work with Section Navigation?

wottech 01-07-2011 10:33 AM

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.

ragtek 01-07-2011 12:40 PM

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.

wottech 01-07-2011 02:09 PM

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.


All times are GMT. The time now is 02:12 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.01481 seconds
  • Memory Usage 1,737KB
  • 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_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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