[TYPO3-core] RFC: Add support for non-prefixed classes in tslib_pibase->pi_classParam()

Martin Kutschker Martin.Kutschker at n0spam-blackbox.net
Fri Aug 25 10:16:46 CEST 2006


Franz Holzinger schrieb:
> Hello Michael,
> 
>> Problem:
>> tslib_pibase->pi_classParam() prefixes every class with the extension 
>> key. This is a big waste which is not needed because there is always a 
>> parent object that defines this:
>>
>> <div class="tx-indexedsearch">
>>    ...
>> </div>
>>
>> Solution:
>> Add a 2nd parameter to the function which can contain classes which 
>> should not be prefixed. Of course this is completely optional!
>>
>> Branches:
>> Trunk only
>>
>>  
>>
>> +    function pi_classParam($class, $addClasses='')    {
>> +        $output = '';
>> +        foreach (t3lib_div::trimExplode(',',$class) as $v)    {
>> +            $output.= ' '.$this->pi_getClassName($v);
>> +        }
>> +        foreach (t3lib_div::trimExplode(',',$addClasses) as $v)    {
>> +            $output.= ' '.$v;
>> +        }
>> +        return ' class="'.trim($output).'"';
>>     }
>>
>>  
>>
> I am no CSS expert. But I think a class name should not contain a ' ' 
> blank.
> I do not understand why class names should be added into one.

A class attribute may contain multiple class names separated with spaces. 
He's compiling the content of the class attribute in a string. Therefore he 
has to add the separator/space.

Masi



More information about the TYPO3-team-core mailing list