PDA

View Full Version : Integration with vBulletin - Dynamic Joomla!VB wrapper


shadowraith
03-06-2008, 10:00 PM
NB: This add-on is not a single sign-on solution.

This add-on provides a means for dynamically wrapping your vbulletin in a Joomla! 1.0.15 portal implementation. This add-on does not touch the core files of either system and there is no requirement to do anything on the Joomla! side unless you've created wrappers for several templates and want to switch between those templates. At which point, you'll simply switch your Joomla! templates via in the Joomla! template manager. And finally, this add-on assumes that your forum is located directly below your joomla implementation directory and is sharing its database. The following instructions include example code snippets to (hopefully) assist in making this add-on proceed as smoothly as possible.

Before attempting to install this add-on, disable your forum and back up your database!!!. This is to ensure you have a working copy in case you run into problems.

.

If you install this PLEASE
Click Install (https://vborg.vbsupport.ru/vborg_miscactions.php?do=installhack&threadid=172308)

Preparation:

Step 1: Create a subdirectory in your current template directory (both locally and on your target site) called, vbulletin. For example, if you're using one of the default templates for Joomla! 1.0.15... say... madeyourweb, you would create your vbulletin directory as follows:

joomla-root-dir/templates/madeyourweb/vbulletin

Step 2: Create three files (head.php, header.php, & footer.php). These will contain content from your index.php file in your selected template directory. So, if you are using the default (madeyourweb), you would use the index.php file in that directory to create the three vbulletin wrapper files. These files should be formatted as follows:

head.php

This file is for your joomla template content between the <head> [...] </head> tags. This is also where you initialize theme variables and add any include statements, for example, from a Rocket Theme ...


<!-- Begin Joomla Head Wrapper -->
<?
$default_style = "style3"; //[style1... style10]
$enable_rokzoom = "true"; // true | false
$template_width = "fluid"; // width in px | fluid
$sidebar_width = "25%"; // width in px or %
$sidebar_side = "right"; // left | right
$menu_name = "mainmenu"; // mainmenu by default, can be any Joomla menu name
$menu_type = "moomenu"; // moomenu | suckerfish | splitmenu | module
$default_font = "default"; // smaller | default | larger
$show_pathway = "true"; // true | false

require($mosConfig_absolute_path."/templates/" . $mainframe->getTemplate() . "/rt_styleloader.php");
$myjoomlacontent = array();
$myjooomlacontent[] = '<meta http-equiv="Content-Type" content="text/html; '._ISO.'" />';
$myjooomlacontent[] = '<link href="'.$mosConfig_live_site.'/templates/'.$mainframe->getTemplate().'/css/template_css.css" rel="stylesheet" type="text/css" />';
$myjooomlacontent[] = '<link href="'.$mosConfig_live_site.'/templates/'.$mainframe->getTemplate().'/css/'.$tstyle.'.css" rel="stylesheet" type="text/css" />';
echo implode( "\n", $myjoomlacontent );
?>
<!-- End Joomla Head Wrapper -->



header.php

This file is for your joomla template content between the <body> tag and the php mosMainbody function call.


<!-- Begin Joomla Header Wrapper -->
<?
$myjoomlacontent = array();
$myjoomlacontent[] = '<div id="outer-800" >';
$myjoomlacontent[] = '<div id="pathway">';
echo implode( "\n", $myjoomlacontent );
mospathway();
$myjoomlacontent = array();
$myjoomlacontent[] = '</div>';
$myjoomlacontent[] = '<div id="leftcol">';
$myjoomlacontent[] = '<a name="menu"></a>';
if (mosCountModules( "left" )) {
echo implode( "\n", $myjoomlacontent );
mosLoadModules ( 'left',-3);
$myjoomlacontent = array();
}
$myjoomlacontent[] = '</div>';

[...]

echo implode( "\n", $myjoomlacontent );
?>
<!-- End Joomla Header Wrapper -->



footer.php

This file is for your joomla template content between the php mosMainbody function call and the </body> tag.


<!-- Begin Joomla Footer Wrapper -->
</div>
</div>
<div class="clr"></div>
</div>
</div>
<!-- End Joomla Footer Wrapper -->


Step 3: Upload your files to the new vbulletin directory that you just created


Step 4: Download the attached product-joomla-vb.xml project-addon and change:


joomla-menu-id-for-your-forum => Joomla! menu id for your forum (you can find this under Itemid in your Joomla! control panel menu manager)


your-joomla-path-goes-here => absolute path to your Joomla! installation



Installation:


Select Plugins & Products => Manage Products and click on the "Add/Import Product" link. And select the above xml from where ever you have stored it locally. This will install your product as well as your supporting plugin.


Select Plugins & Products => Plugin Manager and select Include the Joomla!VB template wrappers, then click save, to ensure the plugin refreshes.


Select vBulletin Options and scroll down to the end of the list. There should be a "Dynamic Joomla Options" in the list. Select that, and verify that your path and your joomla menu id are set correctly. If not, change them to the correct settings and click save.


Select Styles & Templates => Style Manager and create a brand new style with default (or a style you already have in place) as the parent style.

NB: The above intermediate step provides a means to play around with a test template without trashing your existing template. And, it also makes it easier to sandbox without having to restore your database.


Select Common Templates from your dropdown menu of the style you just created.

Common templates has three templates. These are header, headinclude, and footer.



Insert $myjoomladhead at the end of the headinclude template

Insert $myjoomladheader at the end of header template

Insert $myjoomladfooter at the end of footer template

Click save.



Click on your new style, which will launch your forum with the Dynamic Joomla!VB wrapper.


Demo: http://crimsonshadows.net (click on forum to see the seamless integration between the portal and vbulletin)


Notes, debugging, etcetera:


All php function calls, such as mosLoadModules should be made in the order they appear in your template. For example:

<?
$myjoomlacontent = array();

[...]
$myjoomlacontent[] = ' <div id="horiz-menu" class="'.$mtype.'">';
echo implode( "\n", $myjoomlacontent );
mosShowListMenu($menu_name);
$myjoomlacontent = array();
$myjoomlacontent[] = ' <div class="clr"></div>';
[...]

echo implode( "\n", $myjoomlacontent );
?>




vBulletin seems to have problems parsing the raw Joomla! html w/embedded php. Hence the reason to use the $myjoomlacontent buffer variable, which you must dump ala the echo/implode when needing to make a function call that echoes the results as opposed to returning a string.


If you do not have embedded php code, you can simply include the raw code as reflected in the above footer.php example. Or, if you're a brave soul and have some time just import your raw templates and bypass the $myjoomlacontent buffer altogether. Good luck on this latter and if you figure out what the kink is, please let me know. ;)


As far as debugging goes? Hopefully you have access to your php error log or you're displaying your php errors/warnings to the screen. This makes debuging much easier.

The most common errors you can encounter when attempting this type of implementation are leaving off ending quotes, or using a semiquote on html code that already contain a semi quote. My general rule of thumb, if the html code is using quotes, then I use semi quotes to load the string into $myjoomlacontent buffer. Likewise, if it is using semi quotes, I use quotes.

Other errors may be missing variables. I'm using the Rocket Theme templating system therefore my head.php contains the Rocket Theme includes.


As for swithching themes? You will need to create a vbulletin directory under each template directory you may wish to use. Then, create the three aforementioned files (head.php, header.php, footer.php) and upload them to their respective template directory. At which point, it is a matter of using your joomla control panel to switch between templates.

Excellent/Important user feedback/tips

1.) I noticed on your site that when you go from your main page to your
vbulletin page, the navbar font is a different size and/or style. --- I
found a fix for this and the answer lies in the style manager in the VB
admincp. Edit your desired VB style and scroll down the CSS style boxes
until you come to <td>, <th>, <p>, <li>. This is where the problem lies.
Apparantly, implementing the joomla code (which includes the CSS code) is
screwing with the vb css code. The solution was simple; I just edited the
font size and font family under <td>, <th>, <p>, <li>. In my case, I
changed the font size to 9pt and re-arranged the first font style: verdana.
Once I changed these variables, the header and navbar text was identical to
the rest of the board.. No more little annoyance.. :-)

2.) And lastly, this deals more with the rockettheme template code. I
noticed that I couldn't get my board to center correctly in the main
content wrapper; it was a few pixels to the right. (I know.. petty stuff..)
To remedy this I deleted the last dozen or so lines of code from my
header.php file; the code dealing with the right or left nav section (in my
case, the right nav section) If you would like the specific code, don't
hesitate to ask. Your firenze template coding should be nearly identical to
my elemental template from rockettheme.com

One fairly important change though, for anyone even vaguely concerned about server load, you should probably wrap this around the plugin code:

if (THIS_SCRIPT != 'cron')
{
blah blah
}

Otherwise you are loading the whole of Joomla twice on every page load, and it obviously doesn't need to happen the second time, just for the cron jobs.

Support

I will happily answer questions that are not addressed in the above instructions. Feedback is also welcomed.

Addendum

Please do not ask me to write and/or debug your php code! So far, all of the questions I have received are from people who (a) did not even bother to read the detailed instructions that I provided above, and/ or (b) haven't clue one wrt writing php code, much less debugging it.

While I have no problem supporting this product, I do not have time to teach people how to write and debug their own code. Esp considering that the errors encountered thus far could have been easily avoided by reading the instructions!

If you install this PLEASE
Click Install (https://vborg.vbsupport.ru/vborg_miscactions.php?do=installhack&threadid=172308)

Magnumutz
03-07-2008, 02:55 AM
Ok, with that skin, it looks pretty nice... i wonder how it would look like in the default skin or others :D

Good job so far.

shadowraith
03-07-2008, 05:23 AM
i wonder how it would look like in the default skin or others :D
Well, blue & purple are complimentary colors to yellow and orange, so you could squeeze by... Overall, however, I would say changing the color scheme (as opposed to the icon designs) is pertinent to an integrated look.

shadowraith
03-07-2008, 03:01 PM
Btw, for anyone who is interested in seeing what the default vb skin looks like in the wrapped Joomla! I've turned on the vb style switcher. Just scroll down to the very bottom of the page and select "default" from the drop down menu. I'll add a switcher interface to the portal skin later, so you can see the wrapper skin switching as well.

goyo
03-07-2008, 08:41 PM
I salute You shadowraith for this.

A little complicated for a non-programmer but if it works... :o

I'll try this with a Yootheme template. I think it's going to be harder compared to Rockettheme as from January they've switched to a new on-the-fly method gzip javascript files and combine (and gzip) css files in to one (more info here (http://www.yootheme.com/content/view/43/1/))...

I'll definitely coming back with my results.

Thanks again for this much needed wrapper idea/solution. :up:

iogames
03-07-2008, 09:16 PM
demo not working

vau7
03-07-2008, 10:47 PM
'Hi there,

i really made a big joyjump on my desk when i saw this product. Unfortunatly i dont get it to work.

As Result of doing your steps, double-checked of course, i only get a white page.

As MenuID i gave the id to the normal wrapperlink of joomla, which i use to get the board into the rest of the site.

As absolute Path i gave /srv/www/htdocs/web69/html/rap
is the format right so?

Thank you much for your support.

shadowraith
03-08-2008, 12:14 AM
'Hi there,

i really made a big joyjump on my desk when i saw this product. Unfortunatly i dont get it to work.

As Result of doing your steps, double-checked of course, i only get a white page.

As MenuID i gave the id to the normal wrapperlink of joomla, which i use to get the board into the rest of the site.

As absolute Path i gave /srv/www/htdocs/web69/html/rap
is the format right so?

Thank you much for your support.
Hi, the blank page is from a fatal php error. The most common error I'm seeing from others who are experiencing the white page is

parse error, unexpected '<'

This is due to the fact that they are not using the $myjoomlacontent buffer. In other words if you just cut/pasted your index into your files, you will run into probs such as you are seeing. And, as I stated above, vbulletin has a prob w/html that has imbeded php.

ERuiz
03-08-2008, 06:16 AM
Is there any chance of this working on Joomla 1.5.1?

tehtide
03-08-2008, 05:22 PM
I'm with ERuiz... what do we need to do to get this working with 1.5.1?

Also... any chance of having the private message box popping up on joomla when you have a PM?

shadowraith
03-08-2008, 05:28 PM
I wrote the initial add-on for Joomla! 1.5 however since I needed to roll back to 1.0.15 to support the numerous modules/bots, I no longer have those files.

As far as making such a wrapper? You can generate a wrapper by defining your absolute joomla path ($myjoomlapath), template name ($myjoomlatemplate), and, for say, rocket themes, style name ($myjoomlastyle). I would also add these as parameters so that you can easily change them in the vBulletin settings, should you decide to switch themes/styles.

Then, it is a matter of removing the joomla calls in the add-on xml, adding the code to fetch the parameters, and replacing $this->baseurl, $this->template, and $tstyle, respectively, in your head, header, & footer php files. In addtion, you would need to replace the "menu code" with your own home-grown menu function.

Since the concept of this add-on is fairly straight forward, it is simply a matter of hacking this add-on to work with Joomla! 1.5. Or otherwise put, if you are comfortable with Joomla! 1.5 and vbulletin, and have solid php coding knowledge, a 1.5 hack such as the above, while tedious, should be quite simple. Ymmv, of course.

The down side is that a hacked implementation, such as the above is not dynamic. In other words, if/when you switch Joomla! styles, you would also need to change them in the vBulletin settings area. You would also need to upgrade your menu function anytime you changed the main menu. If I went this route, I would create a sharable menu include file, so that regardless the template, that menu function would always be included into the wrapper.

And finally, I have no doubt there is a better approach than the aforementioned for 1.5. However, migrating to 1.5 is not on my "to do" list atm, so unless that changes, I will not have time to investigate it further.

If you have other questions, feel free to pm me.

Sunsetdriver
03-10-2008, 08:39 AM
This is what I was exactly looking for! :eek:
Thank you so much for sharing! :cool:

Does it work also if J and VB don't share the same database? Otherwise do I have to add some code to make it working?

Thanks

shadowraith
03-10-2008, 03:24 PM
In theory, it should work regardless of whether they are in separate databases or not. In reality, it depends upon how they implemented their db classes. For example, are they using a thread resource pool? If not, any real loading will likely result in some odd behavior.

That said, I would first try to ensure it works with an integrated db. Then, once things are working smoothly, repoint vb to it's original seperate db by exporting the integrated db, and loading it into the seperate db.

By doing this, you limit potential sources for error during your trouble shooting phase. Ymmv, of course.

shadowraith
03-11-2008, 03:45 PM
For those of you using Rocket Theme, I received some excellent input regarding the differing font size and alignment problem.

1.) I noticed on your site that when you go from your main page to your
vbulletin page, the navbar font is a different size and/or style. --- I
found a fix for this and the answer lies in the style manager in the VB
admincp. Edit your desired VB style and scroll down the CSS style boxes
until you come to <td>, <th>, <p>, <li>. This is where the problem lies.
Apparantly, implementing the joomla code (which includes the CSS code) is
screwing with the vb css code. The solution was simple; I just edited the
font size and font family under <td>, <th>, <p>, <li>. In my case, I
changed the font size to 9pt and re-arranged the first font style: verdana.
Once I changed these variables, the header and navbar text was identical to
the rest of the board.. No more little annoyance.. :-)

2.) And lastly, this deals more with the rockettheme template code. I
noticed that I couldn't get my board to center correctly in the main
content wrapper; it was a few pixels to the right. (I know.. petty stuff..)
To remedy this I deleted the last dozen or so lines of code from my
header.php file; the code dealing with the right or left nav section (in my
case, the right nav section) If you would like the specific code, don't
hesitate to ask. Your firenze template coding should be nearly identical to
my elemental template from rockettheme.com
The above has been added to the basic instructions. Thanks again, Tiedgen!

Sunsetdriver
03-12-2008, 08:01 AM
In theory, it should work regardless of whether they are in separate databases or not. In reality, it depends upon how they implemented their db classes. For example, are they using a thread resource pool? If not, any real loading will likely result in some odd behavior.

That said, I would first try to ensure it works with an integrated db. Then, once things are working smoothly, repoint vb to it's original seperate db by exporting the integrated db, and loading it into the seperate db.

By doing this, you limit potential sources for error during your trouble shooting phase. Ymmv, of course.
Thanks for your reply :)
Actually I have Joomla and vBulletin in different databases. I'll start doing some tests with your hack and I'll let you know. :cool:

Btw...do you think the same thing could be applied to phpbb3? :erm:

shadowraith
03-12-2008, 04:18 PM
Btw...do you think the same thing could be applied to phpbb3? :erm:
As with anything, if you know how to code, and have the time and patience, it could be done. I admittedly do not know the state of phpbb these daze. My last tinkering was phpbb2. Even so, imho, unless the've re-architected the infrastructure and cleaned up the interfaces, and oh... idunno... tightened up some of their code, the thing leaks like a sieve. Esp when it comes to security. Then again, "secure php-[whatever]" is somewhat of an oxymoron. lolol.

Panagioths
03-12-2008, 05:45 PM
I have a question. Are we just copy the data in the boxes for the 3 files? Because i got a blank page after i applied the theme....

shadowraith
03-12-2008, 07:26 PM
I have a question. Are we just copy the data in the boxes for the 3 files? Because i got a blank page after i applied the theme....
First off, what do you mean by "applied"? Secondly, if you read the detailed instructions (which, given your question about "copying the data in the boxes" causes me to believe that you did not even remotely do), you would not have asked the question you just did. And finally, had you read "up" you would also see that, surprise, surprise, the common problem people seem to be having with installing this very simple mod is not reading the instructions and/or having like, zero understanding of even the most rudimentary php concepts. In other words, just trying to cut/paste your "theme" into the three referent files without bothering to buffer the html (which I explicitly explained in the instructions) will ... surprise, suprise... fail. And, had you ever coded anything in php (even if it was a simple "hello world" script), you would know that a white screen means the php compiler encountered a fatal error in the code. At which point, you could, at the very least, examine the error log which, in fact, gives the file name and line number where the error occurred. And, if worse came to worse, you could at least stare at your code and pretend you even know what you're looking at, and then come here with, you know, a superficially real question?

As it stands now, I am going to disable the "will support" and will not answer any further "all I am getting is a white screen" questions. If you cannot help yourself by at least reading the instructions, then I do not have the time or patience to even remotely consider helping you.

Panagioths
03-12-2008, 07:47 PM
Ok, sorry for not having English as my primary language and sorry for being an amateur in coding and not knowing how to "buffer the html". I humbly seize my existence in order to stop bothering you. Please don't disable the "will support" because others might actually need it.

nonamer69
03-17-2008, 07:32 PM
anyone tested this with 3.7?

btw, thanks shadowraith for your contribution.

goyo
03-19-2008, 09:55 AM
Error in installation description ?

Original description:

* Insert $myjoomladhead at the end of the header template
* Insert $myjoomladheader at the end of headinclude template

Instead (my take):

* Insert $myjoomladheader at the end of the header template
* Insert $myjoomladhead at the end of headinclude template

shadowraith
03-19-2008, 05:54 PM
Error in installation description ?

Original description:

* Insert $myjoomladhead at the end of the header template
* Insert $myjoomladheader at the end of headinclude template

Instead (my take):

* Insert $myjoomladheader at the end of the header template
* Insert $myjoomladhead at the end of headinclude template

Good catch! Thanks for the head's up. Instructions corrected.

vau7
03-22-2008, 01:16 AM
I really cant get it to work, since i dont understand php. Is there anyone who will do it for a few bucks?

jeff21up
03-22-2008, 06:16 AM
Has anyone noticed all the call to undefined errors when viewing in threaded mode?

SOFTMASTER
03-23-2008, 06:36 AM
Ohhh no !!!

I've been working hard during 2 days to integrate manually my joomla template ! Haven't seen an addon could exist :'(

Gonna try it now !

Thank you very much shadowraith !!

shadowraith
03-25-2008, 05:05 AM
Has anyone noticed all the call to undefined errors when viewing in threaded mode?
Hadn't notice that and certainly did not see it before! Will need to track that bit down to see what is occurring. I obviously b0rked something though... :/

Tigratrus
03-31-2008, 08:35 PM
Ok... I took a whack at making this work in J! 1.5.1, but I think it may be beyond my shaky grasp of the differences between J! 1.0x and J! 1.5x and php in general :o. Basically we never messed with 1.0x after we decided that the vB bridges were too unstable, so I don't know that much about 1.0x at all.

The function call mosMainbody doesn't exist in 1.5, I took a stab at it but I'm not at all sure I've got it right.

I also had to modify the plugin a bit, so that it looks more like this:define( '_JEXEC, 1 );
$myjoomlapath = $vbulletin->options['dyn_joomla_path'];
require_once( $myjoomlapath.'/configuration.php' );
require_once( $myjoomlapath.'/includes/joomla.php' );
require_once( JPATH_SITE .'/includes/frontend.php' );
require_once( JPATH_SITE .'/includes/sef.php' );
$mainframe = new mosMainFrame( $database, '', '.' );
$mainframe->initSession();
ob_start();
include_once(JPATH_SITE . '/templates/' . $mainframe->getTemplate(). '/vbulletin/head.php');
$myjoomladhead = ob_get_contents();
ob_clean();
include_once(JPATH_SITE . '/templates/' . $mainframe->getTemplate(). '/vbulletin/header.php');
$myjoomladheader = ob_get_contents();
ob_clean();
include_once(JPATH_SITE . '/templates/' . $mainframe->getTemplate(). '/vbulletin/footer.php');
$myjoomladfooter = ob_get_contents();
ob_end_clean();

Not sure if that's right or not?

If you *do* play with it in 1.5, let us know? Given that we're working with media mogul too, it'd be a real easy implementation for us if you provide updated templates based on RT's MM.:D

I'll keep on banging away on it to see if I can figure out what's wrong... And post back if I make any headway.



James and Susan

OneEyeSleepy
04-02-2008, 04:17 PM
Hi, I am very interested in your wrapper. Its the best I have ever seen at the moment. However, you also posted another file download in the rockettheme.com forum (http://www.rockettheme.com/option,com_smf/Itemid,190/topic,29697.msg156280/), if that is you, under post 11.

Is the file the same as the first post of this topic?

shadowraith
04-05-2008, 06:56 PM
Hi, I am very interested in your wrapper. Its the best I have ever seen at the moment. However, you also posted another file download in the rockettheme.com forum (http://www.rockettheme.com/option,com_smf/Itemid,190/topic,29697.msg156280/), if that is you, under post 11.

Is the file the same as the first post of this topic?
Yes, I just added the instructions that I posted here to that file.

shadowraith
04-05-2008, 06:57 PM
Ok... I took a whack at making this work in J! 1.5.1, but I think it may be beyond my shaky grasp of the differences between J! 1.0x and J! 1.5x and php in general :o. Basically we never messed with 1.0x after we decided that the vB bridges were too unstable, so I don't know that much about 1.0x at all.

The function call mosMainbody doesn't exist in 1.5, I took a stab at it but I'm not at all sure I've got it right.

I also had to modify the plugin a bit, so that it looks more like this:define( '_JEXEC, 1 );
$myjoomlapath = $vbulletin->options['dyn_joomla_path'];
require_once( $myjoomlapath.'/configuration.php' );
require_once( $myjoomlapath.'/includes/joomla.php' );
require_once( JPATH_SITE .'/includes/frontend.php' );
require_once( JPATH_SITE .'/includes/sef.php' );
$mainframe = new mosMainFrame( $database, '', '.' );
$mainframe->initSession();
ob_start();
include_once(JPATH_SITE . '/templates/' . $mainframe->getTemplate(). '/vbulletin/head.php');
$myjoomladhead = ob_get_contents();
ob_clean();
include_once(JPATH_SITE . '/templates/' . $mainframe->getTemplate(). '/vbulletin/header.php');
$myjoomladheader = ob_get_contents();
ob_clean();
include_once(JPATH_SITE . '/templates/' . $mainframe->getTemplate(). '/vbulletin/footer.php');
$myjoomladfooter = ob_get_contents();
ob_end_clean();

Not sure if that's right or not?

If you *do* play with it in 1.5, let us know? Given that we're working with media mogul too, it'd be a real easy implementation for us if you provide updated templates based on RT's MM.:D

I'll keep on banging away on it to see if I can figure out what's wrong... And post back if I make any headway.



James and Susan
Hi, haven't had time to play with 1.5 yet, but this plugin also works with joomla 1.0.15 & vbulletin 3.6.9 (with no changes to the underlying plugin)

cheesegrits
04-13-2008, 08:08 PM
@shadowraith

Nice idea, and thanks for contributing this.

Total time it took me to get it working on two Joomla templates was about 30 minutes - 10 mins reading the notes and installing the XML, and about 10 minutes each chomping up the index.php.

Just FYI, with the two templates I've tried (Rhuk, and JoomlArt's Xenia), the raw chopped up index.php code works just fine as-is without having to use the $myjoomlacontent[] technique. What version of PHP are you running?

One fairly important change though, for anyone even vaguely concerned about server load, you should probably wrap this around the plugin code:

if (THIS_SCRIPT != 'cron')
{
blah blah
}

Otherwise you are loading the whole of Joomla twice on every page load, and it obviously doesn't need to happen the second time, just for the cron jobs.

The issue I'm working on at the moment is to see if I can get rid of the re-draws of things like CSS styled menus that use re-styling of UL elements, etc. It's particularly noticeable on the JA Xenia template, where the 'top' (main) menu draws three times - once as a plain UL, once with the text styling applied, and finally as the horizontal menu. I noticed something similar on your demo site.

Not sure if it'll be possible without some template-specific surgery though.

@nonamer69

anyone tested this with 3.7?

Seems to work OK on 3.7 Beta 5. I've only been testing it for an hour or so though.

-- hugh

cheesegrits
04-15-2008, 08:44 PM
Also need to add this to the plugin:

if ($mosConfig_lang=='') {
$mosConfig_lang = 'english';
}
include_once( $mosConfig_absolute_path .'/language/' . $mosConfig_lang . '.php' );

... otherwise Joomla's language file isn't loaded.

FYI, I tracked that CSS menu styling redraw thing to a template specific bug. Nothing to do with this mod.

-- hugh

cheesegrits
04-16-2008, 04:05 PM
An obvious drawback with embedding vB within J! is that you will very probably run into CSS conflicts. We have two radically different systems trying to share the same sandbox, and they end up stomping on each others CSS toes. I thought I'd document how I resolved these issues on my J! template (JA Xenia), but the same techniques will apply to most styles.

The main issue is obviously that vB's main stylesheet is overriding J! styling, and vice versa. It occurred to me that the first problem (vB stomping on J!) could be solved if all of vB's style selectors were specified as 'descendents' of the J! container wrapper div. In my case, using JA Xenia, this has the ID #ja-containerwrap. By the nature of the way this mod works, all of vB is contained within that div. The ID will vary depending on the J! template you are using, but there should be a 'wrapper' div which obviously surrounds vB.

So, I made a small code mod (much as I hate code mods, but there is no hook available in that location, I've requested one but am not holding my breath!) to vB, in ./includes/adminfunctions_template.php. At the end of the construct_css(), just before the 'return', I added this code:

/*
cheesegrits - joomlawrap CSS hack. For use with shadowraith's Joomla!vB
wrapper hack:

https://vborg.vbsupport.ru/showthread.php?t=172308

Place this code immediately before the 'return' at the end of
the construct_css() function in includes/adminfunctions_template.php

Set $jstyles to the vB style ID's you want to modify, and the CSS ID of the
div in the coresponding J! template which 'wraps' the main body content.

Go to Style Manager, edit and save the vB style(s) you want to modify.
*/
$jstyles = array(
2 => '#ja-containerwrap',
7 => '#wrapper-inner'
);
// test to see if this is one of our J! integration styles
if ($jstyles[$styleid])
{
// grab the wrapper DIV ID
$jcontainer = $jstyles[$styleid];
// loop through vB's $cssarray
foreach ($cssarray as $key => $val)
{
// extract the selectors, i.e. everying before the opening {
if (preg_match('#(.*)\s*\{#',$val,$matches))
{
$oldval = $matches[1];
$newval = '';
if (preg_match('#^body#',$oldval))
{
// if this is vB's 'body', change it to just the wrapper ID
$newval = "$jcontainer ";
}
else
{
// if it's anything but 'body', bust it up ...
foreach (explode(',',$oldval) as $thisval)
{
// ... and prepend the container ID to each selector
$newval .= "$jcontainer $thisval, ";
}
}
// chop any extranous trailing comma/space
$newval = rtrim($newval,', ');
// replace the original selector list with ours
$cssarray[$key] = str_replace($oldval,$newval,$val);
}
}
}


After making this mod and saving the style(s), the main vB CSS on your wrapped vB will now look like this:

#ja-containerwrap .page
{
background: #FFFFFF;
color: #000000;
}
#ja-containerwrap td, #ja-containerwrap th, #ja-containerwrap p, #ja-containerwrap li
{
font: 10pt verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;
}
... etc etc ..


NOTE that this only takes care of the standard vB defined style tags. If you have "extra CSS" defined in your style, you may need to manually prepend the wrapper div ID to the custom CSS definitions.

This goes most of the way to solving the "vB stomping on J!" issue..

This has already gotten rather long, so I'll follow up in another post with the other stuff I had to do to get everything playing nicely together.

-- hugh

cheesegrits
04-17-2008, 12:35 AM
Another quickie ... need to add ...

$my = $mainframe->getUser();

... right after the call to mosMainFrame() in the plugin. Lots of J! widgets need $my defined, it's like J!'s version of vB's $userinfo. Took me a while to work out why several of my J! modules on my vB page were behaving rather strangely!

-- hugh

Sunsetdriver
05-15-2008, 08:31 PM
Has anyone tested it with vb 3.7.0? :confused:
Thanks.

Sunsetdriver
05-16-2008, 10:37 AM
I'm testing the hack wit RT's populus template. It works BUT there's an error displayed at the top of the page:

Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\Joomla\templates\rt_populus\rt_sty leloader.php on line 11
Then if I click on forums titles or reply to a topic, another error appears:
Warning: in_array() [function.in-array]: Wrong datatype for second argument in C:\xampp\htdocs\Joomla\templates\rt_populus\rt_sty leloader.php on line 28

Btw, I've moved $myjoomladhead at the beginning of the headinclude template.

See attachment.


One fairly important change though, for anyone even vaguely concerned about server load, you should probably wrap this around the plugin code:

if (THIS_SCRIPT != 'cron')
{
blah blah
}

Otherwise you are loading the whole of Joomla twice on every page load, and it obviously doesn't need to happen the second time, just for the cron jobs.
Where do I have to put that code? In xml file? And Do I have to oaste only
if (THIS_SCRIPT != 'cron')
{
blah blah
}
?

Thanks

cheesegrits
05-17-2008, 07:10 PM
I'd have to see the three 'chunks' of template to work out why you are getting those errors.

For the 'cron' thing, edit the global_start plugin, and just wrap that if statement around all the code, so it's ...

if (THIS_SCRIPT != 'cron')
{
... original code ...
}

-- hugh

Sunsetdriver
05-18-2008, 12:37 PM
I've fixed it! :D
Rockettheme slightly modified their templates' index.php since firenzie, so some code was left out of the <head></head> section. :D

NOW...I still have some questions:
1) if I change the default style in Joomla's backend (same template but different style), it doesn't change in forum page. Of course it happens 'cause I have to manually change parameters in /vbulletin/head.php. Is there a way to let head.php read parameters directly from template's index.php?
2) How can I display correctly modules in forum page? I tried it but they didn't got displayed well;
3) There's a bug with vb's dropdown menus. As I click on them, they got displayed away from menu (see pic).

Sorry for too many questions :p. Btw, any chance for an updated version with you CSS tips included? (to have Joomla and vbulletin working with own CSS styles).

https://vborg.vbsupport.ru/external/2008/05/11.png

Sunsetdriver
05-18-2008, 01:01 PM
Could someone also explain this?
# vBulletin seems to have problems parsing the raw Joomla! html w/embedded php. Hence the reason to use the $myjoomlacontent buffer variable, which you must dump ala the echo/implode when needing to make a function call that echoes the results as opposed to returning a string.
I think that's why nothing got displayed in modules enabled in VB page :p:o.

Thanks.

Sunsetdriver
05-18-2008, 02:14 PM
Ugh...I've just tried to install the product on my live website and the forum doesn't load.
I've got this error message displayed:

Restricted access
Warning: Unknown: failed to open stream: No such file or directory in [path]/global.php(384) : eval()'d code on line 232

Fatal error: Unknown: Failed opening required '/includes/frontend.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/*******/public_html/forum/global.php(384) : eval()'d code on line 232

my config:

Joomla --> www.mydomain.com
vbulletin --> www.mydomain.com/vbulletin

My plugin's settings:
Enter the full path to your joomla directory: www.mydomain.com

Same error with 'www.mydomain.com/'

But if I type '../' a blank page loads.

Any hint? :erm:

How should I type the url of my joomla installation?
Thanks.

cheesegrits
05-19-2008, 12:39 AM
1) if I change the default style in Joomla's backend (same template but different style), it doesn't change in forum page. Of course it happens 'cause I have to manually change parameters in /vbulletin/head.php. Is there a way to let head.php read parameters directly from template's index.php?


What you could do is extract any style definition lines from the head.php and index.php, create another file to put them in, and 'require' that file from your two versions of the template.


2) How can I display correctly modules in forum page? I tried it but they didn't got displayed well;


I don't seem to have any problems with CMPS modules, can't help you there.


3) There's a bug with vb's dropdown menus. As I click on them, they got displayed away from menu (see pic).


This is a semi-well known quirk of vB's menu control javascript. It assumes there are no blocks on the page between the menu location and the document root which use 'position=absolute' or 'position=relative'. In other words, vB always assumes it is calculating coordinates relative to the top left of the document. But if the menu is within any block which uses positioning (like your J! template), it is then rendered with the coordinates being relative to that block. So the menu is shifted down and to the right.

The only cure I've found for this is a vB file edit, which I hate doing, but I've yet to find a workaround for it. In ./clientscript/vbulletin_menu.js, edit the following function to look like this:

vB_Popup_Menu.prototype.fetch_offset = function(obj)
{
/*
if (obj.getBoundingClientRect)
{
// better, more accurate function for IE
var rect = obj.getBoundingClientRect();

var scrollTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
var scrollLeft = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft);

if (document.documentElement.dir == 'rtl')
{
// IE returns a positive scrollLeft, but we need a negative value to actually do proper calculations.
// This actually flips the scolloing to be relative to the distance scrolled from the default.
scrollLeft = scrollLeft + document.documentElement.clientWidth - document.documentElement.scrollWidth;
}

return { 'left' : rect.left + scrollLeft, 'top' : rect.top + scrollTop };
}
*/

var left_offset = obj.offsetLeft;
var top_offset = obj.offsetTop;

while (YAHOO.util.Dom.getStyle(obj, 'position') == 'static' && (obj = obj.offsetParent) != null)
{
left_offset += obj.offsetLeft;
top_offset += obj.offsetTop;
}

return { 'left' : left_offset, 'top' : top_offset };
};

As always with code edits, make sure you keep an original copy of the file in case you moof it up.

-- hugh

cheesegrits
05-25-2008, 04:02 AM
Just an FYI ...

I found a bug in vB which breaks the WYSIWYG editors in Internet Explorer if the Mootools javascript library (mootools.js) is included on a vB page. So, for instance, you can't post anything or send PM's, or do anything which uses a WYSIWYG editor. It'll keep telling you your post must have more than 10 characters.

Although Joomla 1.0.x itself doesn't include Mootools, a lot of Joomla components and templates do (like almost all the Rocket Themes ones). Joomla 1.5 does include Mootools by default.

I submitted a bug report at vbulletin.com, and it's been marked as 'confirmed and fixed', although they didn't post the fixed code yet. The bug is in vbulletin_textedit.js.

I'll update this post when I find out what the fix is.

[EDIT]

The fix is around line 1423, the two lines commnented with 'hugh' below:

// Force Firefox 1.0 to run it here and Firefox 1.5+ later on, see Bug #22661
// hugh - patched as per http://www.vbulletin.com/forum/project.php?issueid=25602
// if (doinit && typeof Array.prototype.map == 'undefined') { this.editdoc.designMode = 'on'; }
this.editdoc = this.editwin.document; // See: http://msdn.microsoft.com/workshop/author/dhtml/overview/XpSp2Compat.asp#caching
this.editdoc.open('text/html', 'replace');
this.editdoc.write(text);
this.editdoc.close();
if (doinit)
{
this.editdoc.body.contentEditable = true;
// $$$ hugh
//if (typeof Array.prototype.map != 'undefined')
if (is_moz)
{
this.editdoc.designMode = 'on';
}
}

-- hugh

Catmag
05-29-2008, 11:17 AM
I've applied the wrapper (without the $myjoomlacontent buffer) to my test site and all seems to be working relatively well. I am having an issue, though, when I apply the J! core SEF urls. The "/forum" subdirectory is being dropped in any of the links within the forum.

Has anybody run into this problem? Fix?

J! 1.0.15/VB3.7.1

EDIT*** I've managed to work this issue out. mosShowHead() in header.php was causing the problem.

illPhever
06-08-2008, 12:52 PM
I've applied the wrapper (without the $myjoomlacontent buffer) to my test site and all seems to be working relatively well. I am having an issue, though, when I apply the J! core SEF urls. The "/forum" subdirectory is being dropped in any of the links within the forum.

Has anybody run into this problem? Fix?


J! 1.0.15/VB3.7.1

EDIT*** I've managed to work this issue out. mosShowHead() in header.php was causing the problem.
thanks Catmag. i had the same problem. i'm using SEF Advance. removing mosShowHead() in head.php did the trick.

yunie_
06-11-2008, 05:47 PM
ok.. this seems abit too complicated to me (even though i have not tried it).

my concern is.. will this make my website lag? it seems like for every page there is alot of things to fetch..

illPhever
06-12-2008, 06:13 AM
3) There's a bug with vb's dropdown menus. As I click on them, they got displayed away from menu (see pic).

This is a semi-well known quirk of vB's menu control javascript. It assumes there are no blocks on the page between the menu location and the document root which use 'position=absolute' or 'position=relative'. In other words, vB always assumes it is calculating coordinates relative to the top left of the document. But if the menu is within any block which uses positioning (like your J! template), it is then rendered with the coordinates being relative to that block. So the menu is shifted down and to the right.

The only cure I've found for this is a vB file edit, which I hate doing, but I've yet to find a workaround for it. In ./clientscript/vbulletin_menu.js, edit the following function to look like this:

vB_Popup_Menu.prototype.fetch_offset = function(obj)
{
/*
if (obj.getBoundingClientRect)
{
// better, more accurate function for IE
var rect = obj.getBoundingClientRect();

var scrollTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
var scrollLeft = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft);

if (document.documentElement.dir == 'rtl')
{
// IE returns a positive scrollLeft, but we need a negative value to actually do proper calculations.
// This actually flips the scolloing to be relative to the distance scrolled from the default.
scrollLeft = scrollLeft + document.documentElement.clientWidth - document.documentElement.scrollWidth;
}

return { 'left' : rect.left + scrollLeft, 'top' : rect.top + scrollTop };
}
*/

var left_offset = obj.offsetLeft;
var top_offset = obj.offsetTop;

while (YAHOO.util.Dom.getStyle(obj, 'position') == 'static' && (obj = obj.offsetParent) != null)
{
left_offset += obj.offsetLeft;
top_offset += obj.offsetTop;
}

return { 'left' : left_offset, 'top' : top_offset };
};As always with code edits, make sure you keep an original copy of the file in case you moof it up.

-- hugh
those changes didn't seem to work for me. after making the change, the dropdown menu fails to appear at all, and it logs an error, "Error: 'YAHOO' is undefined"

i noticed that on shadowraith's site (http://crimsonshadows.net/forum), he has the same problem with the dropdowns, too.

any other suggestions would be greatly appreciated.

cheesegrits
06-15-2008, 10:01 PM
Apologies, I should have said that fix was for 3.7.

In 3.6 I think you just need to change the 'while' line to this:

while ((obj.style.position == '' || obj.style.position == 'static') && (obj = obj.offsetParent) != null)

And none of that stuff commented out in the 3.7 fix exists, so no need to worry about it.

-- hugh

segwayon
06-21-2008, 03:56 AM
I'm curious if there's an example of an absolute path to the Joomla installation.

The path to my template's folder is "home/domain_name/public_html/templates/template_name/" and in that "template_name" folder is the index.php as well as the new "vbulletin" folder with the new files.

Any pointers appreciated.

cheesegrits
06-22-2008, 10:37 AM
The Joomla install dir is wherever your main Joomla index.php is, which in your case is almost certainly /home/domain_name/public_html

-- hugh

James Argo
06-24-2008, 07:29 PM
shadowraith, thank you thank you thank you!!!

*James Argo clicked Install and Motm*

Today, I'm not only learning how to wrap, but also how to do php buffering! Precious lesson!

One little question, I tried with 2 different templates (madeyourweb and my own template)

somehow I have difficulty with the line : .$GLOBALS['cur_template'].

for example in:

.$mosConfig_live_site. '/templates/' .$GLOBALS['cur_template']. '/images/logo.gif"

I must replace .$GLOBALS['cur_template']. with the template folder name to make it work. Is there any other way to work on it? (So I can just leave it .$GLOBALS['cur_template']. instead of replacing it with template's folder name)?

I tried in local server, J! 1.0.15 & vB 3.6.8.

Thanks
;)
Jaymz

CampinCarl
07-15-2008, 12:09 AM
I keep getting the error "Restricted access" on a white page where my forums used to be :( how do I do this?

Aceman
10-07-2008, 02:01 PM
I also get Restricted Access. Does anyone know of a fix? VB 3.7.3 and J15.

Aceman
10-07-2008, 03:18 PM
defined('_JEXEC') or die('Restricted access'); is at the top of just about all of the joomla files..which is what I think is generating this error.

Norman77
10-07-2008, 04:53 PM
That is indeed what is restricting your access.. somehow something isn't getting called inside joomla setting the JEXEC constant.. I'm looking into this currenlty..

Norman77
10-07-2008, 05:01 PM
I'm not sure if this is compatiable with Joomla 1.5.3, as for one.. they changed the way they determine if you are in a valid MOS (Now Joomla) page.. and after that's fixed there are other errors.. I would not recommend using this on a J1.5.3 install yet..

Espeacke
10-27-2008, 03:46 AM
hello sorry for the inconvenience.
Trying to understand the integration of Joomla with vBulletin not achievement.
I do not speak English.

What gives me a lot of problems is header.php
I got this:
www.adictotejano.com/foro

maybe if you give me his 3 files (header.php, head.php, footer.php) that help me to better understand the structure.

Use the default style and vBulletin in RocketTheme Joomla.
Help please.
------------------------------------------------------------------------
?Using rocket theme and style default vBulletin are correct these files?
http://rapidshare.com/files/157917498/vbulletin.rar

secrtagnt
11-11-2008, 05:31 PM
I've applied the wrapper (without the $myjoomlacontent buffer) to my test site and all seems to be working relatively well. I am having an issue, though, when I apply the J! core SEF urls. The "/forum" subdirectory is being dropped in any of the links within the forum.

Has anybody run into this problem? Fix?


J! 1.0.15/VB3.7.1

EDIT*** I've managed to work this issue out. mosShowHead() in header.php was causing the problem.

I actually have this same problem; however, removing mosShowHead() from head.php removes the header entirely. Anyone else experience this and perhaps knows of another solution?

LCN2007
11-19-2008, 10:39 PM
Any Luck on finishing this up for Joomla 1.5.8?

I would love to make my VB intergrate directly into Joomla.

LCN2007
11-21-2008, 06:29 AM
:( Is anyone willing to port this up for us?

LCN2007
11-26-2008, 04:02 AM
Hey if anyone is interested in getting this coded to work with Joomla 1.5 post here.
https://vborg.vbsupport.ru/showthread.php?t=197188

iBardia
12-27-2008, 08:48 PM
Doesn't work.
:(

SoulSuite
01-13-2009, 08:01 PM
I get Restricted access i'm using Joomla 1.5.7 and vbulletin 3.8. Could u help me please :(

al033
01-14-2009, 12:45 PM
me too Restricted access

KevinL
01-14-2009, 12:52 PM
This says it doesn't work with 1.5.7...

al033
01-14-2009, 01:06 PM
i downgraded still same

Waiter
01-27-2009, 09:40 AM
But works with VB 3.7.3??

Medina
01-29-2009, 07:13 PM
Too bad that it doesnt work for joomla 1.5.9 with vb 3.8.1.

@ Topicstarter; can you please update this mod.?

Thank you.

Omega Prime
03-05-2009, 04:16 AM
Would anyone be able to pick this up and port it to Joomla 1.5x? I know I'm not the only one who'd like this working again ;)

Medina
03-10-2009, 03:20 PM
It should be a great development to make this hack working again.

Cees
03-27-2009, 12:52 PM
Would be awesome if its worked again with 1.5.9 and 3.8.1

iamthemoz
04-09-2009, 10:21 PM
Another vote for getting this working with Joomla 1.5.9 and Vbulletin 3.8 !

outcastrc
05-10-2009, 05:37 PM
This is exactly what I am trying to accomplish with the latest versions of joomla and vbulletin. Please someone update this!!!

globofan
05-27-2009, 10:53 PM
Another vote for getting this working with Joomla 1.5.. and Vbulletin 3.8!

+ Update Someone :)

Brandon Sheley
05-27-2009, 11:08 PM
how is this different from jfusion?

nice idea

Verionia
08-12-2009, 02:39 PM
Any progress? jfusion strips out alot of products/plugins...

PGAmerica
09-14-2009, 03:30 PM
Well, I just noticed that after installing Joomla 1.5.x and vBulletin 3.8x that I get a "Restricted access" error message when loading the forums.

I see that several other people are having the same problem.

Any solutions?

Does this work with vBulletin 3.8x and Joomla 1.5x?

FCS_Heater
09-18-2012, 09:14 AM
Any help for vB 4.2 and Joomla! 2.5 ?

stevieb
08-05-2013, 09:08 AM
Any help for vB 4.2 and Joomla! 2.5 ?

bump - anyone?