vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   [How-to] Make Your vB Template XHTML Validate Correctly (https://vborg.vbsupport.ru/showthread.php?t=157754)

Analogpoint 09-12-2007 10:00 PM

[How-to] Make Your vB Template XHTML Validate Correctly
 
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:
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! :)

foxfirediego 10-21-2007 03:17 PM

thanks dood!

Audentio 10-26-2007 11:47 PM

Awesome, cheers! ;)

Animparadise 11-14-2007 04:47 AM

realy awesome :)

Triky 12-19-2007 10:30 AM

Quote:

Originally Posted by Analogpoint (Post 1338386)
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.

Magnumutz 12-19-2007 11:11 AM

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".

Triky 12-19-2007 12:25 PM

LOL http://www.web-city.it/forum/images/smilies/asd.gif

semauae 12-21-2007 04:37 PM

I have 2175 errors

how can I fix it ?

http://validator.w3.org/check?uri=ht...Inline&group=0

Peter85 02-18-2008 11:21 AM

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:
Code:

                $stylevar['textdirection'] = 'ltr';
Replace that with
Code:

                $stylevar['textdirection'] = 'ltr" xmlns="http://www.w3.org/1999/xhtml';
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.


All times are GMT. The time now is 11:15 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01088 seconds
  • Memory Usage 1,729KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete