Search code examples
urltypo3tt-news

Wrong article when clicking on news article with same title


The editor created multiple tt_news article with the same title. If you navigate to the news you can see the correct excerpt, but when clicking on the detail view you get the article which is not the seen in the excerpt. It is an older article with the same title. The URL looks like this

http://yourdomain.com/news/news-detail/duplicate-article-name.html

The following versions are currently used:

  • CoolURI 1.0.29
  • tt_news 3.0.1
  • TYPO3 4.5.10

CoolUriConf.xml_default has the following content

<uriparts>
    <part>
      <parameter>tx_ttnews[tt_news]</parameter>
      <lookindb>
        <to>SELECT title FROM tt_news WHERE uid=$1</to>
        <t3conv>1</t3conv>
      </lookindb>
    </part>

Now I changed it according to the manual to this

  <uriparts>
    <part>
      <parameter>tx_ttnews[tt_news]</parameter>
      <lookindb>
        <to>SELECT CONCAT(tt1.title,IF(tt2.number>1,CONCAT('-',tt2.number),'')) FROM tt_news as tt1, (SELECT COUNT(*) AS number FROM tt_news WHERE title=(SELECT title FROM tt_news WHERE uid=$1)) AS tt2 WHERE tt1.uid=$1</to>
        <t3conv>1</t3conv>
      </lookindb>
    </part>

I cleared all caches (including CoolURI cache) but now the latest article can be found if clicking on the URL. The URL hasen't changed.

What I'm doing wrong? I even tried it with another browser.


Solution

  • I finally found the error. It was the wrong file I edited. I edited typo3conf/ext/cooluri/cooluri/CoolUriConf.xml_default.

    You find the correct path if you go into the Extension Manager and click on CoolURI. There is a XML path variable where the path to your real CoolUriConf.xml is. In my case it was fileadmin. Now the latest article has the following name:

    http://yourdomain.com/news/news-detail/duplicate-article-name.html

    An older one has this name

    http://yourdomain.com/news/news-detail/duplicate-article-name-2.html

    and so on. There are nicer solutions but all what CoolURI can does.