OK,
I've seen a lot of requests for Widget style for CMS or Home Page here and I couldn't find a solution in these threads, so I went off with my limited knowledge and created my own solution.
ie. I want the VSA Chatbox to load on my CMS landing screen for my site as well as the index of forum.
How to do this. There are a number of steps, be patient, it works (at least for me)
Basically, the process is to quasi-create your own mod. ie. Create a .php file, a template in the style manager and lastly create a widget.
Lastly to go to the VSA Chatbox options and tell it that it is allowed to run on your page/template combo.
Here is how I did mine, feel free to use it/modify it to meet your demands.
Thanks to the work of user "Lynne" for the below thread that simplified the process.
see:
https://vborg.vbsupport.ru/showthread.php?t=228112
*note, the chatbox display is exactly how it's displayed on your forum, in other words, the dimensions of the chatbox are the same inside your widget(which are the dimensions set in the vsa chatbox options), therefore this is not ideal for side-widgets. Or to be fair, this is a 'cheat' on the system just to display the box.
First off, create a .php file I called mine chattybox.php and uploaded this to the root of my forum
NEW .PHP FILE "chattybox.php"
Code:
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
// ########### IN MY CASE chattybox which is the .php filename ###########
define('THIS_SCRIPT', 'chattybox');
define('CSRF_PROTECTION', true);
// change this depending on your filename
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();
// get special data templates from the datastore
$specialtemplates = array();
// ########### NOTE the case-sensitive template name MYCHATBOX ###########
// pre-cache templates used by all actions
$globaltemplates = array('MYCHATBOX',
);
// pre-cache templates used by specific actions
$actiontemplates = array();
// ######################### REQUIRE BACK-END ############################
// if your page is outside of your normal vb forums directory, you should change directories by uncommenting the next line
// chdir ('/path/to/your/forums');
require_once('./global.php');
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
$navbits = construct_navbits(array('' => 'Grrr Chatbox'));
$navbar = render_navbar_template($navbits);
// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'The Infamous GRRR Chatbox';
// ###### NOW YOUR TEMPLATE IS BEING RENDERED ######
$templater = vB_Template::create('MYCHATBOX');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
print_output($templater->render());
?>
Next, I needed to create the MYCHATBOX template, Admin->Styles & Templates->Style Manager Click the drop_down and choose [Add New Template]
Title: MYCHATBOX
Template window you paste the below code. *Note the {vb:raw vsachatbox} between body clamps.
NEW STYLEVAR: "MYCHATBOX"
Code:
{vb:stylevar htmldoctype}
<html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html">
<head>
<title>{vb:raw vboptions.bbtitle} - {vb:raw pagetitle}</title>
{vb:raw headinclude}
{vb:raw headinclude_bottom}
</head>
<body>
{vb:raw vsachatbox}
</body>
</html>
Now that I have the 'mod' created, I will now CALL this mod from an iframe from a StaticHTML Widget.
Go to Admin->vBulletin CMS->Widgets, scroll to the bottom and click on [create new widget]
For Widget type, choose [Static HTML]
For Title choose Chatbox (or anything you like), same thing with description... now click on [SAVE]
This will take you back to the list of Widgets, look on the right-hand-side of your newly created widget "Chatbox" and you will see a [configure] hyperlink, click on that.
This will open the physical code insertion dialogue.
See the code below for how I inserted my chatbox quasi-'mod' as an iframe.
Code:
STATIC HTML WIDGET:
<iframe src="./chattybox.php" name="frame1" scrolling="no" frameborder="no" height = "440" width = "100%">
</iframe>
This is all well and good, we've created the page, the template that tells the page what to do and now a Widget that displays this page, VSA however has some display-type security as in you need to explicetly tell it which pages and templates it can display on, this is good for you and your server.
**Note if you don't change the Show ChatBox on pages/Templates, they will never display
Go to Admin->Settings->Options->VsaChatBox and click [EDIT]
The second option, which by default (i think) is set to [ index ]
[Show ChatBox on pages (comma separated THIS_SCRIPT locations)]
[Blank to show on all pages (not recommended because of server load)]
This option you want to modify by adding your newly create page to the list of display approved pages.
If you followed these instructions to the letter, then your options will change to:
The third option, which approves the templates you want to add your newly created temaplte:
Code:
FORUMHOME,MYCHATBOX
LAST STEP - WOOHOOOOO !
Ok, so we've set everything up, display permissions and all, it's time to show that Widget on your CMS.
In my case, I did the following:
Admin-->vBulletin CMS-->Layout Manager
I wanted it on my "HOME" layout, so with EDIT remaining in the Drop_down, I clicked on [GO] button the on line associated with Home.
This shows the GRID layout of my HOME, with a list of my available widgets, one of which is the newly crated "Chatbox", I click that and then the [>] arrow to add it to the layout, then move it around to where I wanted it, lastly clicking on [SAVE]
THATS IT!
Loaded up the CMS home page and voila the Chatbox is there in all it's glory.
I hope this works for you too.
--The Duck