[TYPO3-dev] hard coded <div> in pi_wrapInBaseClass

Lina Wolf liste at linawolf.de
Thu Aug 12 23:33:00 CEST 2010


  Almost all extensions that come with a non-fluid plugin have this 
TypoScript at the last line:

return $this->pi_wrapInBaseClass($content);

I usually prefere

return $this->cObj->stdWrap($content, $conf['stdWrap.']);

to be more flexible, but that breaks the prefix comments


The result of pi_wrapInBaseClass is wrapping the content with hardcoded HTML Code and comments:

     /**
      * Wraps the input string in a <div> tag with the class attribute 
set to the prefixId.
      * All content returned from your plugins should be returned 
through this function so all content from your plugin is encapsulated in 
a <div>-tag nicely identifying the content of your plugin.
      *
      * @param    string        HTML content to wrap in the div-tags 
with the "main class" of the plugin
      * @return    string        HTML content wrapped, ready to return 
to the parent object.
      */
     function pi_wrapInBaseClass($str)    {
         $content = '<div class="'.str_replace('_','-',$this->prefixId).'">
         '.$str.'
</div>
     ';

         
if(!$GLOBALS['TSFE']->config['config']['disablePrefixComment'])    {
             [...wrap in comments...]
         }

         return $content;
     }

This also means that the div around a plugin cannot be changed without 
changing the code of the extension. At times you might want to use an 
extension in a context where a div cannot create valid code (inside a 
link) or where you dont want the div for another reason (disguising what 
extension you use for security reasons, name collision, ...)

If we would change that function, remove the hard coded div, and create 
it by TypoScripted stdWrap instead what do you think?

If that is not possible at least some function to turn of the standart 
div wrap would be needed.




More information about the TYPO3-dev mailing list