[TYPO3-dev] [Fwd: Re: text/img and img elements with css-class?]

JoH asenau info at cybercraft.de
Tue Dec 16 14:07:09 CET 2008


>> You can even force a
>> certain parameter (doesn't have to be a class) with the
>> parseFunc/HTMLparser in lib.parseFunc_RTE. You can also remove the
>> width and height attributes there (see TSref for that).
>>
> this approach (of which you are talking about) seems to incredibly
> hidden that i haven't yet found a clue.

Just to show you that most of (if not all) the stuff you want is already
there:

lib.parseFunc_RTE {
 externalBlocks := addToList(img)
 externalBlocks {
   img {
     callRecursive = 1
     callRecursive.tagStdWrap {
       HTMLparser = 1
       HTMLparser {
         allowTags = img
         tags {
           img = 1
           img {
             allowedAttribs = alt,class,src
           }
         }
       }
     }
   }
 }

Taken from these parts of TSref:
http://typo3.org/documentation/document-library/references/doc_core_tsref/4.2.0/view/1/5/#id4198758
http://typo3.org/documentation/document-library/references/doc_core_tsref/4.2.0/view/1/5/#id4208523
http://typo3.org/documentation/document-library/references/doc_core_tsref/4.2.0/view/1/5/#id4208672

To get the desired classes in the popup-image-dialogbox use this one as Page
TSconfig:
RTE.default.classesImage = cool,cooler,coolest
http://typo3.org/documentation/document-library/extension-manuals/rtehtmlarea_manual/1.7.4/view/4/4/

And to make the whole thing perfectly fitting the 1em=10px approach you
could try adding a userFunc to the fixAttribs Parameter to process the
values:

lib.parseFunc_RTE {
 externalBlocks {
   img {
     callRecursive.tagStdWrap {
       HTMLparser {
         tags {
           img {
             allowedAttribs = alt,class,src,width,height
             fixAttrib.width.userFunc =
tx_yourextension->user_YourWidthFunction
             fixAttrib.height.userFunc =
tx_yourextension->user_YourHeightFunction
           }
         }
       }
     }
   }
 }

although I'm not sure if the width/height attributes are allowed to contain
em values.
So maybe it would be even better to use the userFunc for an additional style
attribute implementing the desired em values calculated on the size given by
the editors.
So i.e. instead of width="325" you would get style="width:32.5em;"

IMHO this would be much better than just using classes or percentages,
because the editors would be able to work with units they are used to while
defining the size of an image, though still having a relative pendant for
the FE output available and of course you would still be able to override
the size of the inline style, if the editor choose a class by using
!important inside the class definition.

HTH

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your gob sometimes!)
Dieter Nuhr, German comedian
Xing: http://contact.cybercraft.de
T3 cookbook (2nd edition): http://www.typo3experts.com
Jobs: http://www.professionals-only.com






More information about the TYPO3-dev mailing list