[TYPO3-dev] Customizing HTML output of showpic.php

Armin Günther armin.guenther at augusta.de
Thu Nov 10 09:46:21 CET 2011


Hi,

in tslib/showpic.php (t3 version 4.5.2), used for click-enlarge images, 
the HTML output is partly hardcoded and does not validate - see below. 
There have been several bug reports (#14549, #15120, #16235, #16613, 
#18919, #19145) around this problem in the past (changing doctype, 
respecting configured doctype, adding metatags etc.). I hit on this 
problem too as I need valid HTML.

Why not use a template based approach where we can customize the whole 
click-enlarge page (doctype, metatags etc.) and add the dynamic stuff 
via some marks?

BTW: I don't understand why in the code below the robots meta-tag is 
made conditional on $this->title?

$this->title ? '' : '<meta name="robots" content="noindex,follow" />'

Metatags should depend on something like $this->myMetaTags

Best wishes,
Armin



Invalid HTML

> Self-closing tags are not allowed in <!DOCTYPE HTML PUBLIC 
> "-//W3C//DTD HTML 4.0 Transitional//EN">:
> <meta name="robots" content="noindex,follow" />
> <img src="typo3temp/pics/abcdefg.jpg" width="401" height="600" 
> border="0" alt="" />
>
> The default style sheet language must be specified when style 
> attributes are used:
> <body style="margin:0;background-color:#ffffff">


HTML output:

>         $this->content.='
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>
> <html>
> <head>
> <title>'.htmlspecialchars($this->title ? $this->title : "Image").'</title>
>     ' . ($this->title ? '' : '<meta name="robots" 
> content="noindex,follow" />') . '
> </head>
>         '.($this->bodyTag ? $this->bodyTag : '<body>');
>
>         if (is_array($imgInfo))    {
>             $wrapParts = explode('|',$this->wrap);
>            
>  $this->content.=trim($wrapParts[0]).$img->imgTag($imgInfo).trim($wrapParts[1]);
>         }
>         $this->content.='
> </body>
> </html>';
>     }





More information about the TYPO3-dev mailing list