[TYPO3-RTE] TSconfig for colPos

Kim Lang k.lang at diefirma.de
Thu May 10 12:11:23 CEST 2007


Hi everybody,

I have an idea for improvement regarding the TSconfig settings for each 
content column.

Sometimes I have a margin in my layout that needs some special 
formatting in the frontend.

To have the same settings in the BE-RTE it's necessary to create one 
TSconfig for each column.


e.g. for colPos=0

    hidePStyleItems = H1,H2,H5,H6,address,pre

and for colPpos=1

    hidePStyleItems = H1,H2,H3,address,pre



to achieve this I patched the file 
"/typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php" in line 405:
================================================================
$thisConfig = $this->RTEsetup($this->RTEsetup['properties'], $table, 
$field, $row);
================================================================

I added the function RTEsetup to the class to avoid changing two Typo3 
core files.

     * 
============================================================================================================================================================*/
    function RTEsetup($RTEprop, $table, $field, $row)    {
        $type = t3lib_BEfunc::getTCAtypeValue($table,$row);

        $thisConfig = is_array($RTEprop['default.']) ? 
$RTEprop['default.'] : array();
        $thisFieldConf = $RTEprop['config.'][$table.'.'][$field.'.'];
        if (is_array($thisFieldConf))    {
            unset($thisFieldConf['types.']);
            $thisConfig = 
t3lib_div::array_merge_recursive_overrule($thisConfig,$thisFieldConf);
        }
        if ($type && 
is_array($RTEprop['config.'][$table.'.'][$field.'.']['types.'][$type.'.'])) 
    {
            $thisConfig = 
t3lib_div::array_merge_recursive_overrule($thisConfig,$RTEprop['config.'][$table.'.'][$field.'.']['types.'][$type.'.']);
        }

//================================================================
        // new function
        foreach($row as $field=>$value) {
            if 
(is_array($RTEprop['config.'][$table.'.'][$field.'.']['values.'][$value.'.'])) 
    {
                $thisConfig = 
t3lib_div::array_merge_recursive_overrule($thisConfig,$RTEprop['config.'][$table.'.'][$field.'.']['values.'][$value.'.']);
            }
        }
//================================================================

        return $thisConfig;
    }
    /* 
============================================================================================================================================================


Because of these changes it's possible to make the following TSconfig 
settings:

================================================================
RTE.default {
    hidePStyleItems = H1,H2,H5,H6,address,pre
    editorBodyId = content
}


RTE.config.tt_content.colPos.values.1 {
  hidePStyleItems = H1,H2,H3,address,pre
  editorBodyId = rightCol
}
================================================================





To apply another CSS format with the same CSS file to the RTE I added 
the following changes:

/typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php
Line: 1085
================================================================
if($this->thisConfig['editorBodyId']) {
    $registerRTEinJSString .= 'RTEarea['.$number.']["editorBodyId"] = "' 
. $this->thisConfig['editorBodyId'] . '";';
}

if($this->thisConfig['editorBodyClass']) {
    $registerRTEinJSString .= 'RTEarea['.$number.']["editorBodyClass"] = 
"' . $this->thisConfig['editorBodyClass'] . '";';
}
================================================================


/typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js
Line: 3011
================================================================
if(RTE["editorBodyId"]) config.editorBodyId = RTE["editorBodyId"];
if(RTE["editorBodyClass"]) config.editorBodyClass = RTE["editorBodyClass"];
================================================================


/typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js
Line: 1091
================================================================
if(this.config.editorBodyClass) doc.body.className = doc.body.className 
+ ' ' + this.config.editorBodyClass;

if(this.config.editorBodyId) doc.body.id = this.config.editorBodyId;
================================================================




Now I can write the following CSS:

================================================================
BODY.htmlarea-content-body {
    background-color: #ffffff;
    padding: 10px;
}
BODY#rightCol.htmlarea-content-body {
    background-color: #E5E7E9;
}


H4 {
    font-size: 12px;
    color: #00000;
}
#rightCol H4 {
    font-size: 10px;
    color: #ffffff;
    background-color: #334055;
}

================================================================


The XHTML in the frontend:
================================================================
      <div id="content">
    <!--###standardCol###-->
    standardCol
      <!--###standardCol###-->
      </div>
          <div id="rightCol">
    <!--###rightCol###-->
    rightCol
    <!--###rightCol###-->
      </div>
================================================================




What do you think?


Regards
Kim Lang


More information about the TYPO3-project-rte mailing list