View Full Version : Solution to importing forum variables
myetalk
02-17-2006, 10:48 AM
Solution to importing vB Functions to use in the vB Drupal header.
It's really simple, so for anything that you just need to call the function for it to work just follow these steps.
1) Find the function that you would like to include in the header. Ex: $simple_global_announcement for me.
2) Open up your FTP, go to your vB Drupal Directory --> Themes --> defaultvb (in my case), then download the defaultvb.theme or the .theme for other templates.
3) Open that up with a text editing software. Ex: Dreamweaver.
Find this:
$sessionurl
AFTER this, add:
$simple_global_announcement OR what ever function you wanted included.
Don't forget to add a coma ( , ) after $sessionurl.
4) Save the defaultvb.theme file and upload to your theme folder.
5) Go to your AdminCP - Styles & Templates - Style Manager - Your Style --> drupal_header, then add ANYWHERE in this the function that you wanted included.
For example: I added $simple_global_announcement at the bottom of the header. And VOILA! The function is broughten up in your vB Drupal.
Remember, this works for all simple functions, tested on the drupal_header template.
Hope this helps!!
Charles
sifuhall
02-17-2006, 01:30 PM
Thank you for posting this. I will be needing it very soon!
myetalk
02-17-2006, 01:32 PM
Thank you for posting this. I will be needing it very soon!
no problem, my pleasure ;)
juanchi
02-21-2006, 09:37 PM
Just to say that this tip is one of the best you can find about this integration, it should be made an steaky.
myetalk
02-21-2006, 09:53 PM
Just to say that this tip is one of the best you can find about this integration, it should be made an steaky.
lol, thank you Juanchi, I'll sticky it ;)
As a reference for those of us who don't know all the available vB functions is there a list of these that you could link to?
myetalk
02-24-2006, 09:37 AM
As a reference for those of us who don't know all the available vB functions is there a list of these that you could link to?
Well this is mainly for add-ons (Mods and hacks) that need you to just add a simple function to the header, forumhome, or footer.
These are the functions I got to work with:
$simple_global_announcement, $totalthreads, $totalposts, $numbermembers, $totalonline, $newusername, $vbcollapse, $newuserid, $navbar_ava, $threadbits, $welcomeheaders
This is all from some hacks, and it all works in the header or footer, when you add them to the place I wrote in the first post :)
uhhh most excellent! I hadnt got to this yet but was dreading it. Now... not so much.
Thanks for this.
myetalk
02-24-2006, 09:54 AM
uhhh most excellent! I hadnt got to this yet but was dreading it. Now... not so much.
Thanks for this.
My pleasure :)
Caerydd
12-26-2006, 02:52 PM
I know defaultangy isn't made to be edited directly, but I wish to import a variable into it. Specifically quick account switching doesn't seem to work in the drupal environment. Would I add the variable
/**
* Global variables to import in these theme functions
*/
global $defaultangy_importvars;
$defaultangy_importvars = array(
//'page' => array('welcomeheaders', 'stuff'),
//'node' => array(),
// ...
);
in there?
elmuerte
12-27-2006, 04:44 AM
you can extend the defaultangy theme by creating a custom.php file in the same directory, this will allow you to add _new_ things.
To make certain global variables available to vbulletin templates used in existing theme functions you can use the $defaultangy_importvars array
(you can simply put that in the custom.php file).
Usually you need to make certain variables available in the global template space (e.g. for the whole page).
For example the variable $welcomeheaders
To make this available in the VBDRUPAL or navbar template (which are being used from the defaultangy_page function add the following (to your custom.php):
$defaultangy_importvars['page'] = array('welcomeheaders');
this should make the variable $welcomeheaders available in the VBDRUPAL or navbar template.
$defaultangy_importvars['page']
'page' is the name of the theming function: defaultangy_name
and it has an array with variable names that will be imported from the global namespace.
Caerydd
12-27-2006, 07:46 AM
okay, much clearer thank you!
Bilderback
04-03-2008, 12:38 AM
What if I dont use the defaultangy theme?
I use a regular/customized drupal theme and I have a custom vbulletin variable
which I want to call to a block.
What I have is Joomlaworks Frontpage Slideshow which calls forum content
through a custom plugin assigning the content to a varianbe $jwfpss
I can use this variable in any vbulletin template but I wish to use it in vbdrupal block.
Would I first have to globalize it in vbulletin?
Goddess
04-04-2008, 12:51 PM
if you're using a phptemplate theme, you can use a template.php file to call custom variables. can't speak for the other theme engines, because that's the one i'm using. :)
Bilderback
04-05-2008, 11:17 PM
I have tried it with the defaultangy theme but it does not display in a block.
I have a single variable: $jwfpss;
A vbulletin plugin assigns this variable as:
ob_start();
include('featured/mod_fpslideshow.php');
$jwfpss = ob_get_contents();
ob_end_clean();
After adding a custom.php file like:
<?php
$defaultangy_importvars['page'] = array('jwfpss');
?>
I tried the following in a block:
<?php
echo $jwfpss;
?>
I am assuming its possibly due to this being a variable and not a template.
I have tried other options such as adding $jwfpss to the vbdrupal template
but still does not work.
Any ideas on how to get this to display?
Goddess
04-07-2008, 11:02 AM
I have tried other options such as adding $jwfpss to the vbdrupal template
but still does not work.
Any ideas on how to get this to display?
well, i won't claim to understand this completely because i haven't worked on making one variable available to the other side myself, so with that caveaat, i'm wondering if you should be importing the variable to 'block' instead of page, because you're trying to enable it in the block template, not the page template...