Web Accessibility -- Joomla Templates -- HTML Validation Errors -- jdoc: style=xhtml PDF Print E-mail

 

Document type does not allow element "..." here, ...

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").


Here's a sample problem -- you have a block-level element (e.g., 'div') inside an 'h3' element when you view the page source but you can't find out where to change in your Joomla template. 

 

The problem is that you can't have a 'div' inside your header 3 element but you can have a 'span' element. 

When you look at your template HTML coding for your index file, you see something like:
<h3><jdoc:include type="modules" name="user4" style="xhtml" /></h3>


How to fix in your Joomla template.

The style="xhtml" is optional and is defined in templates/system/html/modules.php. The default modules.php file contains the following layouts:

  • OPTION="table" (default display) modules are displayed in a column.
  • OPTION="horz" makes the modules appear horizontal. Each module is output in the cell of a wrapper table.
  • OPTION="xhtml" makes modules appear as a simple div element.
  • OPTION="rounded" makes modules appear in a format that allows, for example, stretchable rounded corners. If this $style is used, the name of the <div> changes from moduletable to module.
  • OPTION="none" makes modules appear as raw output containing no element and no title.

Resolution:

Edit the modules.php file (keep a backup of the original file).

Copy [CTRL-C] the following code for 'xhtml (divs and font headder tags)'
...........
Code:
/*
 * xhtml (divs and font headder tags)
 */
function modChrome_xhtml($module, &$params, &$attribs)
{
 if (!empty ($module->content)) : ?>
  <div class="moduletable<?php echo $params->get('moduleclass_sfx'); ?>">
  <?php if ($module->showtitle != 0) : ?>
   <h3><?php echo $module->title; ?></h3>
  <?php endif; ?>
   <?php echo $module->content; ?>
  </div>
 <?php endif;
}
........

Paste [CTRL-V] the code and name it 'myxhtml (spans and font headder tags)', and change the 'div' to 'span'
....
Code:
/*
 * myxhtml (spans and font headder tags)
 */
function modChrome_myxhtml($module, &$params, &$attribs)
{
 if (!empty ($module->content)) : ?>
  <span class="moduletable<?php echo $params->get('moduleclass_sfx'); ?>">
  <?php if ($module->showtitle != 0) : ?>
   <h3><?php echo $module->title; ?></h3>
  <?php endif; ?>
   <?php echo $module->content; ?>
  </span>
 <?php endif;
}

Then, in your index.html file for your template, change the line (using the above problem) to:
<h3><jdoc:include type="modules" name="user4" style="myxhtml" /></h3>

 

That should do it!

 

 

 

Total Visitors

mod_vvisit_counterTo Date:1348875

Today: Jul 25, 2014