Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
[How-to] Make Your vB Template XHTML Validate Correctly
Analogpoint
Join Date: Feb 2007
Posts: 656

by Analogpoint Analogpoint is offline 13 Sep 2007

Have you tried validating your vBulletin-powered site with the W3C validator? 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 validating the vB forums.

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:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Replace with text:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

This will add the xmlns attribute to the <html> tag and now your pages should validate as XHTML.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Turns into


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Happy Validating!
Views: 3331
Reply With Quote
Comments
  #2  
Old 21 Oct 2007, 16:17
foxfirediego foxfirediego is offline
 
Join Date: Aug 2005
thanks dood!
Reply With Quote
  #3  
Old 27 Oct 2007, 00:47
Audentio's Avatar
Audentio Audentio is offline
 
Join Date: Mar 2007
Real name: Mike
Awesome, cheers!
Reply With Quote
  #4  
Old 14 Nov 2007, 05:47
Animparadise's Avatar
Animparadise Animparadise is offline
 
Join Date: Sep 2007
realy awesome
__________________
First iranian anime ,manga & animation professional forum.http://forums.animparadise.com
Reply With Quote
  #5  
Old 19 Dec 2007, 11:30
Triky's Avatar
Triky Triky is offline
 
Join Date: Mar 2007
Location: [Italy]
Originally Posted by Analogpoint View Post
You can check this by validating the vB forums.
With the new vB release, it should be corrected. If you check now that link, it say is Valid XHTML 1.0 Transitional.
__________________
I'm italian, I am learning english.. so, please, if you see any errors in my grammar or spelling, let me know via PM. Danke!
Reply With Quote
  #6  
Old 19 Dec 2007, 12:11
Magnumutz's Avatar
Magnumutz Magnumutz is offline
 
Join Date: Feb 2006
Real name: Alex
I wanted to say the same thing about 2 hours ago Triky... but then i looked at the thread date and i said to myself: "Naaaaaaaaaaaah".
__________________

Reply With Quote
  #7  
Old 19 Dec 2007, 13:25
Triky's Avatar
Triky Triky is offline
 
Join Date: Mar 2007
Location: [Italy]
LOL
__________________
I'm italian, I am learning english.. so, please, if you see any errors in my grammar or spelling, let me know via PM. Danke!
Reply With Quote
  #8  
Old 21 Dec 2007, 17:37
semauae's Avatar
semauae semauae is offline
 
Join Date: Sep 2006
Real name: [email protected]!Q
I have 2175 errors

how can I fix it ?

http://validator.w3.org/check?uri=ht...Inline&group=0
Reply With Quote
  #9  
Old 18 Feb 2008, 12:21
Peter85 Peter85 is offline
 
Join Date: Sep 2007
The fix suggested by Analogpoint has the downside of making all templates showing up as modified.

Another fix for making vBulletin 3.6.x validate is to hack the includes/functions.php file.
Line 4628 (or somewhere around there) should read:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Replace that with

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

and you will have xmlns="http://www.w3.org/1999/xhtml'; inserted in the right place in your <html>-tag.

My suggestion for a fix is much uglier but it has the benefit that it can be undone very easily and doesnt make all your templates show up as modified.

Edit:
After doing some testing I realised that that variable is also used in some of the templates. So there will still be template edits. Hopefully not as many though.

Last edited by Peter85; 19 Feb 2008 at 10:55.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 06:29.

Layout Options | Width: Wide Color: