Used code:

 $animation_settings=array (
  'params' => array ( 
    'width' => '940',
    'height' => '106',
  ),
  'flashvars' => array (
    'banner_files' => $photo_files,
    'banner_slogans' => $photo_titles,
  ),
 );
 $animation=url($directory.'/flash/header.swf');
 print swf($animation,$animation_settings);

This displays correctly but does not validate XHTML 1.0 Strict.

The problem is in:
<param name="flashvars" value="banner_files=%2Fsites%2Fdefault%2Ffiles%2Fimagecache%2Fheader_pictures%2FFishersAtAviles.jpg%2C%2Fsites%2Fdefault%2Ffiles%2Fimagecache%2Fheader_pictures%2Fafter_the_fun.jpg&banner_slogans=Sea%20fishing%2CFun%20activities" />

The different flashvars are separated by & and it should by &amp; according to the w3c validator:

An entity reference was found in the document, but there is no reference by that name defined. Often this is caused by misspelling the reference name, unencoded ampersands, or by leaving off the trailing semicolon (;). The most common cause of this error is unencoded ampersands in URLs as described by the WDG in "Ampersands in URLs".

Entity references start with an ampersand (&) and end with a semicolon (;). If you want to use a literal ampersand in your document you must encode it as "&amp;" (even inside URLs!).

I'll try to come up with a patch for this.

CommentFileSizeAuthor
#2 ampersand_xhtml_compliant.patch566 bytesñull
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ñull’s picture

I see that drupal api function drupal_query_string_encode is used and that in fact the problem might be in core. It function ends with :

return implode('&', $params);

May be this should be?:

return implode('&amp;', $params);

Should this be reported as a core bug? I would like to leave that decision to the developers of this module.

ñull’s picture

A patch to core that makes it xhtml 1.0 strict compliant. I am not going to be involved in the political discussion around this. My option is that this core function should be xhtml strict compliant and it isn't. The patch is the quickest solution to the problem.

Stuart Greenfield’s picture

Good spot.

The patch changes the core of Drupal which is tricky.

An alternative is for SWF Tools to implement its own version of drupal_query_string_encode(), which is I'm now testing using swftools_query_string_encode(). This implodes using &.

Testing on a local piece of content and the original version fails validation (as described), but with the modification it passes.

Will test further to verify there are no adverse effects...

Stuart Greenfield’s picture

Status: Active » Needs review

Seems ok - committed on DRUPAL-6--3