Back to vBulletin 3 Articles

[How-to] Make Your vB Template XHTML Validate Correctly
by Analogpoint 13 Sep 2007

Have you tried validating your vBulletin-powered site with the http://validator.w3.org? A standard vB installation will fail the validation with one error-- it's missing the xmlns attribute for html tag at the very beginning. You can check this by http://validator.w3.org/check?uri=www.vbulletin.com%2Fforum.

The <html> tag should look like <html xmlns="http://www.w3.org/1999/xhtml">

So until vB's default templates are changed to include the xmlns info, I needed a workaround, and I didn't want to manually edti dozens of templates.

In comes a brilliant feature that is implemented in the ACP. Expand the Styles & Templates section and click on Replacement Variable Manager.

Add a new Replacement Variable for each of your parent styles.

Search for text:
Code:
<html
Replace with text:
Code:
<html xmlns="http://www.w3.org/1999/xhtml"
This will add the xmlns attribute to the <html> tag and now your pages should validate as XHTML.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" lang="en">
Turns into

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
Happy Validating!

vblts.ru supports vBulletin®, 2022-2024