Disable a TYPO3 extension or removing a hook specified by another extension

In some cases we may need to disable some hooks that are defined by another extension. Say for example in a recent case, I had to disable js_css_optimizer when a typo3 FE editor is logged in. This was necessary as feeditadvanced was not working together with js_css_optimizer.

So the moment I needed the services of feeditadvanced, I had to disable js_css_optimizer, so I added the following code:

unset($GLOBALS[‘TYPO3_CONF_VARS’][‘FE’][‘cssCompressHandler’]);

We have to make sure that we do this at correct stage, for example, if the extension we wanted to disable has already finished it’s execution, then we may not get desired result, so we may have to add another hook that executes much before the hook we wanted to remove.

Disable js_css_optimizer when using feeditadvanced

I recently noticed that the extension feeditadvanced when used alog with js_css_optimizer gives an error stating that a CSS file is missing!

This is probably caused because feeditadvanced did nt take into consideration the css files that are created by the js_css_optimizer.

Normally we do not need js_css_optimizer if we would like to edit content. So added a quick solution that disables the js_css_optimizer when using on feeditadvanced.

You will need to edit the following file:

typo3conf\ext\feeditadvanced\hooks\class.tx_feeditadvanced_pagerenderer.php

Open this and add the following 3 lines of code inside the IF Condition of the function preProcessPageRenderer():

unset($GLOBALS[‘TYPO3_CONF_VARS’][‘FE’][‘cssCompressHandler’]);
unset($GLOBALS[‘TYPO3_CONF_VARS’][‘FE’][‘jsCompressHandler’]);
unset($GLOBALS[‘TYPO3_CONF_VARS’][‘FE’][‘concatenateHandler’]);

Full code for preProcessPageRenderer():

public function preProcessPageRenderer($params, $parentObject) {

if ($parentObject->getConcatenateFiles() && (t3lib_div::_GP(‘eID’) === ‘feeditadvanced’) && $GLOBALS[‘TBE_TEMPLATE’]) {

unset($GLOBALS[‘TYPO3_CONF_VARS’][‘FE’][‘cssCompressHandler’]);
unset($GLOBALS[‘TYPO3_CONF_VARS’][‘FE’][‘jsCompressHandler’]);
unset($GLOBALS[‘TYPO3_CONF_VARS’][‘FE’][‘concatenateHandler’]);

$compressor = t3lib_div::makeInstance(‘t3lib_compressor’);
$cssOptions = array(‘baseDirectories’ => $GLOBALS[‘TBE_TEMPLATE’]->getSkinStylesheetDirectories());
$params[‘cssFiles’] = $compressor->concatenateCssFiles($params[‘cssFiles’], $cssOptions);
}
}

It would have been great if css files created by js_css_optimizer are used within feeditadvanced, unfortunately that is not the case at present.
Till then I hope we may use the above code.

How to include a custom PHP script in TYPO3

This article is covered in detail in the “doc_core_tsref” here:

http://typo3.org/documentation/document-library/references/doc_core_tsref/current/

Check the article “1.12. PHP include scripts” and 1.13. Case story for detailed info.

In short we can easily include a script in two ways.

Both these code must be written in the setup section of a template record.

  1. Using the CONFIG object.
    ex:
    config.includeLibrary = fileadmin/templates/myscript.php
  2. Using the PAGE object.
    ex:
    page.100.file = fileadmin/templates/myscript.php

That should do the trick. Fo more info I suggest that you please refer “doc_core_tsref“.

Image Quality settings in TYPO3

TYPO3 has a very cool mechanism to resize images automatically.

Often we might notice that the images like JPEG/PNG when resized are either blur, or their quality may not be very good.

This can easily be changed by loggin into the install tool and changing the following configuration from the “All Configuration” menu:

[GFX][jpg_quality] = 90

[GFX][png_truecolor] = 1