Thread: Integration with vBulletin - Dynamic Joomla!VB wrapper
View Single Post
  #34  
Old 04-16-2008, 04:05 PM
cheesegrits's Avatar
cheesegrits cheesegrits is offline
 
Join Date: May 2006
Posts: 500
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01085 seconds
  • Memory Usage 1,804KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete