Welcome to Our Community

Registration on our forums are now open for some days! Feel free to sign up today.

[HOW TO - vB4] Stylebridge vB3.8 -> vB 4.0 22 Jan 2010

[HOW TO - vB4] Stylebridge vB3.8 -> vB 4.0

  1. XenForo Rocks
    This article is for all coders, who want's a quick port of the mods into vB4.

    What does this means ?
    You can use you vB 3.8 templates in a vB 4.0 include the stylevars.
    You need to change ALL the conditions and ALL vars.
    This bridge is only for the style !

    What must I do before starting ?
    You need to create 2 new templates. I call 'em stylebridge.css and stylebridge_headinclude.



    You can do this simply by importing the attached product (it will only create those two new templates).
    • stylebridge.css
      this templates contais the new style for the templates (tcat, thead, alt1, alt2 ....)
    • stylebridge_headinclude
      this is the original vB4 headinclude templates without reset-fonts.css and vbulletin.css and some other .css.
    How to modify my mod (PHP) ?
    Somewhere in you mod, you will find this line

    Code:
    require ("./global.php"); 
    
    The trick is now, to change the "headinclude".
    Simply add below:

    Code:
    $alt1_color = $alt2_color = substr (vB_Template_Runtime::fetchStyleVar('body_color'), 0, 7);
    $alt1_background = substr (vB_Template_Runtime::fetchStyleVar('threadbit_background'), 0, 7);
    $alt2_background = substr (vB_Template_Runtime::fetchStyleVar('threadbit_alt_background'), 0, 7);
    $templater = vB_Template::create('stylebridge.css');
        $templater->register('alt1_color', $alt1_color);
        $templater->register('alt2_color', $alt2_color);
        $templater->register('alt1_background', $alt1_background);
        $templater->register('alt2_background', $alt2_background);
    $stylebridge = $templater->render();
    $templater = vB_Template::create('stylebridge_headinclude');
        $templater->register_page_templates();
        $templater->register('stylebridge', $stylebridge);
        $templater->register('custom_global_css_reference', $custom_global_css_reference);
    $headinclude = $templater->render();  
    some Differencec/changes
    If you are using class="page" inside a template, you should change it to: class="body_wrapper".
    Also, there are two border classes: One for tcat and the other for thead.
    Here comes an example:

    Code:
    <table class="tborder" cellpadding="{vb:raw padding}" cellspacing="{vb:math {vb:raw padding}/2}" border="0">
    <tr>
    <td class="tcat">enter your text here</td>
    </tr>
    </table>
    <table class="tborder2" cellpadding="{vb:raw padding}" cellspacing="{vb:math {vb:raw padding}/2}" border="0">
    <tr>
    <td class="thead">enter your text here</td>
    </tr>
    </table>
    Footnote:
    Remember that this won't work for ALL mods.



    This could be while:
    • you're mod doesn't use "global.php"
    • you are using vb3 and vb4 styles at the same time
    • ... anything else
    I've tested it with only one of my mods on a vB4 containing 4 different styles.

    If you have any excitations, please let me know.
    It would also be greatfully, if you gave me feedback how it works.

    Regards
    Coroner

    EDIT: Fixed the Style when the CSS is stored as files
  • About Us

    Our community has been around for many years and pride ourselves on offering unbiased, critical discussion among people of all different backgrounds. We are working every day to make sure our community is one of the best.
  • Like us on Facebook

  • Buy us a beer!

    The management works very hard to make sure the community is running the best software, best designs, and all the other bells and whistles. Care to buy us a beer? We'd really appreciate it!

    Donate to us!