WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Droplets & Snippets => Topic started by: CodeALot on May 28, 2015, 12:02:14 PM

Title: Validation error when there's a "div" in your droplet
Post by: CodeALot on May 28, 2015, 12:02:14 PM
I have a droplet that reads the thumbnail of a Youtube-video, places it in a DIV that 'floats', and in that DIV, under the thumbnail, there is a caption line. Clicking the thumbnail 'fires' a Fancybox containing the video.

So far all is well.

The droplet works, and it contains the following lines:

Code: [Select]
$returnvalue = '<div class="video-thumbnails">';
$returnvalue .= '<a class="variousvideo fancybox.iframe" href="http://www.youtube.com/embed/'.$id.'?rel=0&amp;autoplay=0">';
$returnvalue .= '<img alt="Click to watch video" src="http://img.youtube.com/vi/'.$id.'/0.jpg" /></a>';
$returnvalue .='<br /><div style="min-width:100%; text-align:center;">';
$returnvalue .= $titel.'<br /><small>'.$maker.'</small></div>';
$returnvalue .= '</div>';
return $returnvalue;

The only problem I'm having here is that according to the W3C validator, this is wrong, because in the WYSIWYG-editor there will be P-tags around the droplet. Since a DIV cannot exist within P-tags, this throws an error.
 
Even though the droplet works just fine, I'd like to get rid of the validation errors. For some clients (government-type) this is essential.  Any suggestions?
Title: Re: Validation error when there's a "div" in your droplet
Post by: instantflorian on May 28, 2015, 12:48:27 PM
You can either use a code2-section and put the droplet call there or format the droplet call in the wysiwyg section as "Normal (Div)" (so there you have nested divs, what is not very good neither, but should not throw any validation error at least).