Friday, June 25, 2010

vBulletin 4 .XML Converter

It's really inconvenient to develop plugins for vBulletin these days since the 2 systems (vBulletin 3 and vBulletin 4) use different template engines (or so called). After a lot of frustrations, I finally made a converter which will "read" your old .xml product file and make it vBulletin 4 compatible. Please note that it doesn't magically make the plugins work in vBulletin 4 (which involves a lot of things), it just makes sure the template will be parsed correctly in vBulletin 4's system just like how it's supposed to be done in vBulletin 3's. Changes are made under several aspects

  1. Variable accessing
    • Array accessing will be updated to the new way. No more $array[key], it should be {vb:raw array.key}
    • StyleVar accessing (via vb:stylevar)
  2. Phrasing (support both simple phrases and compound ones)
  3. IF/ELSE condition in template
The new .xml file will be saved in the same directory with the suffix _vb4. Okie, here is the code (in PHP, obviously)

You may want to change the $rootdir to different directory... Enjoy