vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Integration with vBulletin - Dynamic Joomla!VB wrapper (https://vborg.vbsupport.ru/showthread.php?t=172308)

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:

PHP 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

Quote:

Originally Posted by nonamer69 (Post 1467315)
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:

PHP Code:

    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:

PHP 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(
        
=> '#ja-containerwrap',
        
=> '#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:

Code:

#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 ...

PHP Code:

    $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:
Code:

Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\Joomla\templates\rt_populus\rt_styleloader.php on line 11
Then if I click on forums titles or reply to a topic, another error appears:
Code:

Warning: in_array() [function.in-array]: Wrong datatype for second argument in C:\xampp\htdocs\Joomla\templates\rt_populus\rt_styleloader.php on line 28
Btw, I've moved $myjoomladhead at the beginning of the headinclude template.

See attachment.


Quote:

Originally Posted by cheesegrits (Post 1489923)
One fairly important change though, for anyone even vaguely concerned about server load, you should probably wrap this around the plugin code:

PHP 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
Code:


       
PHP Code:

       

               

               
               

                       
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?
Code:

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

Quote:

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.


All times are GMT. The time now is 10:11 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01287 seconds
  • Memory Usage 1,803KB
  • 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
  • (5)bbcode_code_printable
  • (6)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)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