Question on vb to xen mod converter?

AWJunkies

Active member
I have made a converter to convert the XML files of vB over to xen format not sure legalities of sharing such a thing? It doesn't of course convert everything but does do phrases, templates, settings. Doesn't do plugins or install code. Can anyone enlighten me if this is something I can share with all to speed up porting addons or if I should keep it to myself.

Thanks.
 
Since vBulletin and XenForo do not share 1 line of code, 1 phrase, 1 template, or 1 setting, I'm now very confused.
 
You are welcome to share it, but I think its usefulness might be very limited, except possibly for phrases and settings. XenForo templates are radically different from vBulletin templates, both in structure and approach, so attempting to convert them doesn't seem to make much sense to me. As for phrases and settings, I guess we'd need to see exactly what kind of conversion you do.
 
I will show example. before and after in a a little bit. It basically saves the developer a lot of time changing formats for the templates, phrases, settings. I am talking vb4 to xen not vb3 to xen just as a clarification and I know it doesn't share one line of code the same but format wise. Guess it is best to show. So give me a bit and will do a mockup not real code example or some basics of what it does.
 
Sample phrases vb4:
Code:
            <phrase name="setting_piratepoker_key_title" username="AWJunkies" version="4.0.3"><![CDATA[Key]]></phrase>
            <phrase name="setting_piratepoker_key_desc" username="AWJunkies" version="4.0.4"><![CDATA[Example Only]]></phrase>

Converts to xen:
Code:
        <phrase title="option_piratepoker_key" global_cache="0" version_id="408" version_string="4.0.8 LITE"><![CDATA[Key]]></phrase>
        <phrase title="option_piratepoker_key_explain" global_cache="0" version_id="408" version_string="4.0.8 LITE"><![CDATA[Example Only]]></phrase>

In this example it auto converts:

name=
to
title=

setting_
to
option_

removes _title

_desc
to
_explain

replaces any vb4 inner with xens example (the inner stuff is set before running script):
Code:
username="AWJunkies" version="4.0.3"
to
global_cache="0" version_id="408" version_string="4.0.8 LITE"
 
Setting and setting group from vb4
Code:
        <settinggroup name="Pirate_Poker" displayorder="75000">
            <setting varname="piratepoker_key" displayorder="1">
                <datatype>free</datatype>
                <optioncode></optioncode>
                <defaultvalue></defaultvalue>
            </setting>
        </settinggroup>

converts to option and option group
Code:
        <group group_id="Pirate_Poker" display_order="75000" debug_only="0"/>
        <option option_id="piratepoker_key" edit_format="textbox" data_type="string" can_backup="1">
              <default_value></default_value>
              <edit_format_params></edit_format_params>
              <sub_options></sub_options>
              <relation group_id="Pirate_Poker" display_order="1"/>
        </option>

In this example it auto converts:

settinggroup name
to
group group_id

displayorder
to
display_order

Adds debug_only="0"/

setting varname
to
option option_id

saves displayorder and places it within relation tag

converts setting data to xen formats
 
Phrases are going to be relatively simple, as there are only a finite number of ways one can store a key with a text value and a version number. However I'm curious to see what you've done with settings/options, as the two systems really have nothing at all in common.
 
Last but not least templates :) I will give two examples a js type switch and a core code change. First will be the js example.

vb4 js example:
Code:
<script type="text/javascript" src="example/clientscript/example.js"></script>
<script type="text/javascript">
    var example= "{vb:rawphrase example}";
    var exmaple2={vb:raw vboptions.example2};
    {vb:raw example_js_vars}
</script>

converts to xen:
Code:
<xen:require js="library/Example/js/example.js" />
 <script type="text/javascript">
     var example= "{xen:phrase example}";
     var exmaple2={$xenOptions.example2};
     {$example_js_vars}
 </script>

vb:rawphrase
to
xen:phrase

vb:raw vboptions
to
$xenOptions

vb:raw (non vboptions, meaning core output)
to
$

Converts the js src or any css so on to xen format as well
 
Phrases are going to be relatively simple, as there are only a finite number of ways one can store a key with a text value and a version number. However I'm curious to see what you've done with settings/options, as the two systems really have nothing at all in common.

The settings are quiet easy actually once you are familiar with XML and parsing and creating tags and so on it is just a matter of making a link system. Been doing this stuff for decades UBB none database to vB :) and the links as an example.
 
Now time for core template :) hope you like this one. Again depends on the coder and following structures and formats to core of vb but any who here is example. This is a live example by the way sorry didn't feel like changing it.

vb4 template simple:
Code:
<vb:if condition="$vboptions['piratepoker_topad']">
    <div class="blockhead" style="height:16px;padding-{vb:stylevar right}:{vb:math {vb:stylevar padding}/2-1};font-weight:bold">
        {vb:rawphrase pp_advertisement}
    </div>
    <div class="blockbody" style="padding:4px;margin:0px;border-top:0px;border-bottom:1px;border-{vb:stylevar left}:1px;border-{vb:stylevar right}:1px;border-color:{vb:stylevar shade_color};border-style:solid;">
        {vb:rawphrase pp_topad}
    </div>
    </vb:if>

converts to xen:

Code:
<xen:if is="{$xenOptions.piratepoker_topad}">
        <div class="selection">
            <h2 class="heading">{xen:phrase pp_advertisement}</h2>
            <div class="sectionContent secondaryContent">
                {xen:phrase pp_topad}
            </div>
        </div>
        <br />
    </xen:if>

converts ALL if statements to xen format so means opening and closing
Code:
vb:if condition
to
xen:if is

/vb:if
to
/xen:if

any div class blockhead is converted to open div with adding innhtml to the h2 format till close hard to explain.

Code:
<div class="blockhead" style="height:16px;padding-{vb:stylevar  right}:{vb:math {vb:stylevar padding}/2-1};font-weight:bold">
         {vb:rawphrase pp_advertisement}
     </div>
to
       <div class="selection">
             <h2 class="heading">{xen:phrase pp_advertisement}</h2>

notice in above it converts the
Code:
vb:rawphrase
to
xen:phrase

then the div class blockbody is converted to open close itself with end close selection
Code:
    <div class="blockbody"  style="padding:4px;margin:0px;border-top:0px;border-bottom:1px;border-{vb:stylevar  left}:1px;border-{vb:stylevar right}:1px;border-color:{vb:stylevar  shade_color};border-style:solid;">
         {vb:rawphrase pp_topad}
     </div>
to
            <div class="sectionContent secondaryContent">
                 {xen:phrase pp_topad}
             </div>
         </div>
notice again phrase conversion.

Again it does even more in depth then that just a quick example.
 
Sorry for some of the smiley faces I think you get the gist of it. I am working on install code convert as well now that outputs to php class::method system. Again I am not sure if I can release such a thing to the public or how vB would feel that your can convert a mod like this. I would love to share this personally with xenforo and have them test verify and let me know what I should do with it. As I soon will have all my mods ported and would love for everyone else as well and I am sure xenforo :).

Sorry it is really late time to sleep hope you see this before I crash.

I do have to stress this wont work for all mods. But I can always add to it to work for most mods just have to take a look at the mod and can add into core bridge.

After diving more into the code I hope to be able to just have a person enter a few details then blamo the mod is converted.
 
AWJunkies- try surrounding your code in [code] or [html] tags to prevent the smilies being parsed.
 
Top Bottom