Posted by & filed under TYPO3.

The latest version of tt_news (3.0.0 development) has been said to improve performance. However, it still leaves a lot to be desired. Indexing tables can speed up some queries, but the reason why tt_news is so slow is the number of queries it generates, especially in LIST view. Stepping through the extension with the debugger shows how big the problem really is. There are plenty of tips about optimizing tt_news cache in the tt_news news list, but they bypass the main problem – the fact that tt_news is s-l-o-w. Below you will find the way that I have used to speed up significantly the generation of the LIST. It requires modifying tt_news code, and requires some understanding of the structure of the 4,000+ line PHP file. It can be used on any recent version, not just the latest, and requires customization in each case. All changes take place in /pi/class.tx_ttnews.php

The one function in the current development version of tt_news is isRenderField, which (although undocumented) checks if the field is supposed to be displayed. Unfortunately, this function does not work as desired – it requires TypoScript setup, that, again is undocumented in this development version.

I wrote these functions as a replacement. What they do is parse the template part for markers, and later in the functions check if the markers are present. If the marker is not used in the template, why spend time to query the database and run lines of code?

function isRenderMarker($marker) {
   if (in_array($marker, $this->renderMarkers))
      return true;
   return false;
function getMarkers($template)
   preg_match_all('/###(.+)###/Us', $template, $matches);
   return $matches[0];

When loading the template, it has to be parsed for markers. In tt_news 3.0.0, it is done here:

$t['total'] = $this->getNewsSubpart($this->templateCode, $this->spMarker('###' . $templateName . '###'));
$t['item'] = $this->getLayouts($t['total'], $this->alternatingLayouts, 'NEWS');
// Parse out markers in the templates to prevent unnecessary queries and code from executing
$markers = $this->getMarkers($t['total']);
foreach($t['item'] as $item)
   $markers = array_merge($markers, $this->getMarkers($item));
$this->renderMarkers = array_unique($markers);

Now, just go through the rest of the code (specifically getItemMarkerArray), and wrap any part with the if statement:

   // render the field

For example:

// get image markers
$markerArray['###NEWS_IMAGE###'] = '';
if ($this->isRenderField('image') && $this->isRenderMarker('###NEWS_IMAGE###')) {
   $markerArray = $this->getImageMarkers($markerArray, $row, $lConf, $textRenderObj);

Make sure to go through any function that extend tt_news (comments, tt_ratings, etc) by using the extra marker hook, and add the code there, as these functions are executed for each item in the list and might waste a lot of time and resources if their output is never displayed. Example:

function extraItemMarkerProcessor($markerArray, $row, $lConf, &$pObj) {
      // Stuff

Results? LIST view generation time decreased from 20-30 seconds to 0.7-1.4 seconds. I hope this was the intention of the isRenderField function, and will make it to the final release of tt_news 3.0

Patch for testing:tt_news_performance_patch

Posted by & filed under Programming.

New version of the PHP IDE has been released. The key feature in this release is HTML navigation and preview features, that help visualize changes as you’re coding. This is a really helpful feature, as I usually have to switch to a browser to see my changes. I am curious to see how this feature will work with my CMS and other heavy templated projects.

Other features in this release:

  • HTML code navigator. New HTML mode is added to PhpED’s Code Navigator. Clicking on the elements of HTML tree places the cursor on the corresponding line of HTML code, making HTML editing really easy. Learn more about HTML Code Navigator
  • HTML Preview. Added by popular demand, HTML Preview feature lets you see how your HTML file is displayed in the browser while you are editing the file in the Editor. Learn more about HTML Preview
  • HTML Code Folding. PhpED users have long enjoyed state of the art PHP Code Completion and other PHP Editor Tools provided in the IDE. HTML Code Folding and Code completion enables the same functionality for HTML files. PhpED Code Folding automatically detects and marks HTML Tags and allows you to mark and collapse any part of the text in the Editor. Learn more about HTML Code Folding and Code completion in PhpED 5.5!
  • Added by popular request: Multiple Keywords Sets. This feature allows you to group reserved words in any language supported by PHP IDE in multiple groups and assign different styles of syntax highlighting to each group. For example, you can create a set consisting of HTML tags related to table and set the special style of syntax highlighting for them.
  • Added by popular request: Short Cuts for Templates – now you can insert snippets of PHP code with simple keyboard click

More info: NuSphere

Posted by & filed under News & Politics.

In today’s economy, its nice to know some people are feeling good…

«Проникновение наше по планете, особенно заметно вдалеке.
В общественном французском туалете есть надписи на русском языке»
–Владимир Высоцкий