GithubHelp home page GithubHelp logo

cooluri's People

Contributors

bednee avatar jaapen avatar jpmschuler avatar mad-develop avatar maximilian-walter avatar mbrodala avatar pitchart avatar plojewski avatar quingkhaos avatar sascha-schieferdecker avatar tmotyl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cooluri's Issues

mysql_error() undefined when using php 7

Running TYPO3 7.6.9 with cooluri.
Everything works fine with php 5.6.5, however when changing to php 7 I receive
Call to undefined function Bednarik\Cooluri\Core\mysql_error()

cooluri and crawler extension

Hi! I have a TYPO3 6.2 Installation. I am using cooluri 1.0.38 and crawler 3.6.dev and just discovered that as long as cooluri ist installed, no items are added to the index. After uninstalling cooluri crawling and indexing works again ...

strange behaviour when frontend called by GeneralUtility::getUrl

I encounter a strange behaviour using coolURI 1.1.3 on TYPO3 7.6.x (multiple installations and versions tested):

the Extension cs_seo uses the function "GeneralUtility::getUrl" to load the frontend-page and analyse it's content. when coolURI is active, it logs the following behaviour on devlog.
when GeneralUtility::getUrl is called with this url: http://dev.abc.local/index.php?id=103 - the following gets logged:

SITESCRIPT: /index.php?id=103
Getting domain for 103
Looking for domain on page 103
Looking for domain on page 4
Looking for domain on page 1
Resolved domain: dev.abc.local
URL from cache 2: dev.abc.local@downloads/
SITESCRIPT: /dev.abc.local/downloads/
DOMAIN: dev.abc.local

as you can see, the domain "dev.abc.local" gets suddenly prepended to the URL itself - this behaviour just occurs when called via backend - page requests in the frontend work as expected.
the IP of these log-entries are always the server's IP itself, not the IP from the logged-in backend-user. i suspect there may be something going on with redirects/session-variables which may not be present when called with getURL?

I tried tracing the error down in several coolURI functions but had no luck - what may be the cause of this error?

TYPO3 8.6 compatibility

As for issue #53, cooluri is not ready for TYPO3 CMS 8.6.

I'm migrating our current TYPO3 7.6 installation to the 8.6 because LTS is coming, and we will have to face this issue.
Do you have any guide lines to start implementing it ?

Thanks

Multidomain and Domainlanguages

Is this functionality is no longer available?

Integration/CoolUri.php:
if (self::$confArray['MULTIDOMAIN']) {
} elseif (\Bednarik\Cooluri\Core\Translate::$conf->domainlanguages) {
The one excludes the other?

Previously, there was a grouping function for domainlanguages?

<domainlanguages>
<domain lang="0" group="1">www.example.com</domain>
</domainlanguages>

Why do u save the Domain (multidomain & domainlanguages) in the Database?

Thanks.

Consider HTTP statuscode 301 for all redirects

Currently when opening an URL like http://example.org/foo CoolURI automatically redirects to http://example.org/foo/. (Mind the trailing slash.)

This happens with the default behavior of the PHP header() function for the Location header which in turn uses the HTTP statuscode 302 unless overridden.

Given that URLs without trailing slash are always only redirected this has some impact on SEO where these URLs are kept in the search index for revisiting.

Thus I'd like to suggest to have all of these redirects use HTTP statuscode 301 instead.

Tag new release?

Please tag a new release, so we can get the latest and important fixes.

Support for TYPO3 4.5

Since the latest few commits on master, CoolURI no longer works with TYPO3 4.5. Is that intended? According to the description on TER it should support TYPO3 4.5 too.

Add git branches

for different versions.

And perhaps git tags for final releases.

php7 session errors - permission denied

Hi,

this is my current setup:
Typo3 7.6.23
CoolUri 1.1.3
php7

I recently upgraded from Typo3 7.6.15 to 7.6.23 and switched to php7.
Since then I get errors in my log file:

Core: Error handler (FE): PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown line 0 Changes in fields: header,l18n_diffsource.

Core: Error handler (FE): PHP Warning: session_start(): open(/tmp/sess_deleted, O_RDWR) failed: Permission denied (13) in /homepages/XX/XXXXXXXXXX/htdocs/XXX/htdocs/typo3conf/ext/cooluri/Classes/Integration/CoolUri.php line 41 Changes in fields: sys_language_uid,tx_flux_children,l18n_diffsource.

Core: Error handler (FE): PHP Warning: Unknown: open(/tmp/sess_deleted, O_RDWR) failed: Permission denied (13) in Unknown line 0 Changes in fields: l18n_diffsource.

After completing the typo3 update and php switch I cleared all cashes and did a "FORCE UPDATE OF ALL LINKS" of CoolUri. This led to hundreds of error messages. Now I get a few every week.

I tried to set the session.save_path manually via php.ini, but 1und1 doesn't support this.

Any idea why CoolUri suddenly can't write session data anymore? It seems all CoolUri links are still generated correctly.

Thanks
Daniel

Add Git tags

Please add Git tags for every released version. Currently 1.0.37 could be added for d964623.

Root URL not processed

The root URL / is not processed by CoolURI:

// check if the only param is the same as the TYPO3 site root
if ($paramsinurl == substr(PATH_site, strlen(preg_replace('~/$~', '', $_SERVER['DOCUMENT_ROOT'])))) return;

This makes it impossible e.g. to enforce path segments like language on it; for example accessing http://example.org/ should always redirect to http://example.org/en/ unless there already is a language path segment.

Bug: Url Cache rebuild mistake

Hello,

Situation:
We have a Typo3 with 3 Website in it.
CoolUri was set to multidomain etc.

What happens:
die First 1/2 Year was all fine, but in my Christma Holdy come an intresting rebuild mistake.
1 of the 3 Sites rebuild it's Url false.

Before: domain.dlc@Level1/Level2...
Become: domain.dlc:[email protected]/Level1\Level2...

Have you any idea what it can be?

Greetings
Dirk

session_start() really necessary?

Hi,
is there a way without session_start() for ordinary visitors of the sites?
My question is motivated by the EU law about placement of cookies and user notices. We would prefer to prevent placing cookies, if it's not really necessary.

Kind regards

cHash Typo3 8.7

We need a condition in the Configuration-File for cHash.
In Typo3 8.7 need tx_indexedsearch_pi2 the chash. Powermail too.

Example:

<predefinedparts>
    <part for="tx_news_pi1">
      <parameter>cHash</parameter>
    </part>

    <part for="tx_myext_pi1">
      <parameter>cHash</parameter>
    </part>
</predefinedparts>

If is setting "for" you can check the combination for chash and ext-key.

Setting pageNotFoundOnCHashError is not nice.

Core: Error handler (FE): PHP Warning: array_merge(): Argument #1 is not an array in /typo3conf/ext/cooluri/Classes/Integration/CoolUri.php line 558

The error ame up in typo3 protocol as an error after switch to 7LTS i think using 1.1.3. Still present in 1.1.4:

Core: Error handler (FE): PHP Warning: array_merge(): Argument #1 is not an array 
in /typo3conf/ext/cooluri/Classes/Integration/CoolUri.php line 558

It's about the array_merge-line in the snipped below. As a solution I'd suggest moving the if (!$page) break; before the if ($langId) which shouldn't be a problem at all, as $page should have at least a uid, and the lang overlay should just add/override stuff und thus $page should be empty afterwards if it was set before.

$q  = $db->exec_SELECTquery('*', 'pages', 'uid=' . $id . $enable);
$page = $db->sql_fetch_assoc($q);

$count = self::getTemplateCount($id);

if ($count['num'] > 0 || $page['is_siteroot'] == 1) {
    return $pagepath;
}

if ($langId) {
    $q = $db->exec_SELECTquery('*', 'pages_language_overlay', 'pid=' . $id . ' AND sys_language_uid=' . $langId . $enable);
    $lo = $db->sql_fetch_assoc($q);
    if ($lo) {
        unset($lo['uid']);
        unset($lo['pid']);
        $page = array_merge($page, $lo);
    }
}
if (!$page) break;

Could create a simple pull request, but wondered 2 things:

  1. why should the page object be empty at all - that would mean it's a deleted page, why should this be triggered at all as the function? (function getPageTitleBE and getPageTitle)
  2. does nobody else have this error in their logs? is it perhaps a strange config option on my end?

Languages on different domains documentation issue.

In documentation is
[globalString = ENV:HTTP_HOST= *example.cz]
but should be:
[globalString = IENV:HTTP_HOST= *example.cz]

using ENV prevents crawler and indexed search to correctly index translated pages

prefix for tx_news pagination widget

I want to add prefix for pagination widget, but without success,
I use this code:

<predefinedparts>
        <part key="page-(.*)" regexp="1">
            <parameter>tx_news_pi1[@widget_0][currentPage]</parameter>
        </part>
</predefinedparts>

the result is http://mydomain.com/2/
but i need http://mydomain.com/page-2/

any hint how to achieve prefix to work with tx_news?

CoolURI TYPO3 8.2 ready

Hallo Cooluri Team,

thank you for your great work. I like CoolURI because it is so easy and works nearly out of the box. Much better than realurl :-)
I just finished a website on TYPO3 8.2 and wanted implement cooluri. Unfortunately it is not TYPO3 8 ready. When do you plan a port on version 8?

Thanks and regards
Martin

Setting up url parameters in Extensions

Hi Team! First of all this isn't really an issue but a question: Is it possible to extract the uriparts from the CoolUriConf.xml into a file inside an Extension and load this file dynamically? We are working on a typo3 modularization and faced this problem. Hope you guys could help and thank you for this awesome extension ;)

Reduce the amount of queries - getDomain

Cleanup the getDomain function, so the cache works well. The problem is, that the input "$id" is modified in the loop and so the cache do not work because the rootline is always checked, if the domain is not one the initially checked page. Change the while loop to a deterministic recursively called function and cache on each level. Remove more than 500 queries on my homepage again :)

Regards,
Tim

patch.txt

cooluri does not follow the TYPO3 url_scheme page property

There is a problem when it comes to the combination of cooluri, multidomain and mixed url_scheme page properties.
On a domain, the links to another domain's page keep the current page protocol instead of the protocol filed in the url_sheme page properties, leading to secure resources errors in browsers (in my case, a search form is present on every pages but the action of this form links to a unique domain).

Replacing hard coded http protocol line 322 of file Classes/Integration/CoolUri.php by a conditionnal assignment fixes the problem.

SQL errors on DB schema update

There are some issues with the SQL syntax used to set up the link_* tables. These are the changes suggested by the DB compare tool:

ALTER TABLE link_cache CHANGE url url char(255);
Current value: char(255) default NULL

ALTER TABLE link_cache CHANGE tstamp tstamp TIMESTAMP default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP;
Current value: timestamp NOT NULL default 'CURRENT_TIMESTAMP' on update CURRENT_TIMESTAMP

ALTER TABLE link_cache CHANGE sticky sticky tinyint(1) unsigned default 0;
Current value: tinyint(1) unsigned default '0'

ALTER TABLE link_cache DROP KEY url;

ALTER TABLE link_cache ADD KEY url (url(255));

ALTER TABLE link_oldlinks CHANGE link_id link_id int(10) unsigned NOT NULL default 0;
Current value: int(10) unsigned NOT NULL default '0'

ALTER TABLE link_oldlinks CHANGE url url char(255);
Current value: char(255) default NULL

ALTER TABLE link_oldlinks CHANGE tstamp tstamp timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP;
Current value: timestamp NOT NULL default 'CURRENT_TIMESTAMP' on update CURRENT_TIMESTAMP

ALTER TABLE link_oldlinks DROP KEY url;

ALTER TABLE link_oldlinks ADD KEY url (url(255));

Performing these yields the following errors:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'char(255) default NULL' at line 1
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'timestamp NOT NULL default 'CURRENT_TIMESTAMP' on update CURRENT_TIMESTAMP' at line 1
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'tinyint(1) unsigned default '0'' at line 1
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'int(10) unsigned NOT NULL default '0'' at line 1
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'char(255) default NULL' at line 1
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'timestamp NOT NULL default 'CURRENT_TIMESTAMP' on update CURRENT_TIMESTAMP' at line 1

We are using TYPO3 6.2.15.

Wrong localized path issue

I'm using the latest version of Typo3 6.2 LTS and I got a problem with the localized paths in CoolUri.

Language Setup:

  • English default language
  • German second language (additional language)

Here is the root typoscript template:

# multi language setup
config.linkVars = L
config.uniqueLinkVars = 1
config.sys_language_uid = 0
config.language = en
config.locale_all = en_US.UTF8
config.htmlTag_langKey = en

[globalVar = GP:L = 1]
config.sys_language_uid = 1
config.language = de
config.locale_all = de_DE.UTF8
config.htmlTag_langKey = de
[global]

Here is the relevant part of the cooluri config (the other stuff is untouched):

  <valuemaps>
    <valuemap>
      <parameter>L</parameter>
      <value key="">0</value>
      <value key="de">1</value>
    </valuemap>
  </valuemaps>

And here is the simplified page setup:

One Page with the page title Imprint and the german translation Impressum

And here is the error:

  • /imprint - shows me the correct english content and the language menu shows me /imprint for english and /de/impressum for german
  • /de/impressum - shows me the correct german content and the language menu shows me /de/impressum for german but it shows me /impressum for english
  • /impressum - shows me the english content

I don't get the reason why the language menu renders these wrong paths.

And here are the cached links:

  • impressum/ - L=0&id=5
  • imprint/ - id=5
  • de/impressum/ - L=1&id=5

Have you got an explanation for the problem?

404 after clearing link cache

Expected Behavior

After clearing the link cache I can access pages with deep links, example link given below.

Current Behavior

Every time I clear the link_cache and link_oldlinks table, the pages further down the page tree on my website throw an 404-error when trying to access them. This error exists until a parent page containing a link to this website is called.
For example, I can’t access https://www.heco.de/en/edelstahl/flanges/welding-neck-flanges/pn-16.html directly after clearing the cache, but only after I navigate downwards from https://www.heco.de.

Your Environment

  • TYPO3 4.5.10
  • CoolURI 1.0.39

Ideas

Is there a way to trigger filling of the link cache automatically? Is this kind of behaviour fixed in any of the newer versions?

params2cool: Condition for $uriFromCache is not type-safe

In the class link.Translate.php in params2cool is written:

$uriFromCache = $this->getCachedUri($params, $forceUpdate);
$cacheduri = false;
$updatecacheid = false;
if ($uriFromCache!=null) {
    if (is_array($uriFromCache)) {
        // not good, still needs to be refactored
        // these paramters are read in the end to
        // refresh cache
        $updatecacheid = $uriFromCache[0];
        $cacheduri = $uriFromCache[1];
    } else {
        return $uriFromCache;
    }
}

$uriFromCache!=null is TRUE even if $uriFromCache is an empty string (''). This prevents that the $uriFromCache is returned. We think that the condition should be one of these:

if ($uriFromCache!==null)
if (!is_null($uriFromCache))

Support array parts for userfunc

Currently parameters can only be referred to with the deepest level they have been put into an URL, e.g.:

<uriparts>
    <part>
      <parameter>tx_myext[foo][bar]</parameter>
      <!-- ... -->
    </part>
</uriparts>

For custom part building via a userfunc, it would be useful if a part could also specified to match an array of values, e.g.:

<uriparts>
    <part>
      <parameter>tx_myext</parameter>
      <userfunc>...</userfunc>
    </part>
</uriparts>

The whole matched parameter array (tx_myext tx_myext) could be passed to the userFunc to allow for advanced part building using an array of values instead of only a plain one.

fails to work on 6.2.14

Commit c5408a9 produces following errors in log:

Core: Error handler (FE): PHP Warning: array_reverse() expects parameter 1 to be array, null given in /var/www/web7/html/devel/typo3conf/ext/cooluri/Classes/Core/Translate.php line 616

Core: Error handler (FE): PHP Warning: call_user_func() expects parameter 1 to be a valid callback, class 'tx_cooluri' not found in /var/www/web7/html/devel/typo3conf/ext/cooluri/Classes/Core/Functions.php line 334

Downgrade to 93ab12e works

php 5.5.28
typo3 6.2.14

TYPO3 7.6 Uncaught TYPO3 Exception

Cooluri doesn't work with TYPO3 7.6 LTS,
throws an error:

`
#1: PHP Warning: call_user_func() expects parameter 1 to be a valid callback, class 'tx_cooluri' not found in /home/public_html/project/typo3conf/ext/cooluri/Classes/Core/Functions.php line 335

`

Language in links to default language ignored (L=0)

When retrieving the title of a page to generate a cool URI a link parameter like L=0 is ignored and replaced with the current frontend language.

This results in e.g. links to the default language of a page being shown just like the current URL.

Example:

  • /hello/ (id=42&L=0)
  • /de/hallo/ (id=42&L=1)

If you access /de/hallo/ the link back to id=42 is /hallo/ instead of /hello/ since L=0 is ignored and L=1 is used instead.

Missing query arguments in language menus

When generating e.g. language menus with addQueryString, current internal query string arguments are not taken into account.

This can easily be reproduced by opening e.g. a news record and having a look at the URI pointing to translations of that news record: the URI will point to the detail page instead of the specific record.

We currently use the following to map the news parameter within an URI:

<part>
  <parameter>tx_news_pi1[news]</parameter>
  <lookindb>
    <to>SELECT title FROM tx_news_domain_model_news WHERE (uid=$1 or l10n_parent=$1) AND sys_language_uid={L=0}</to>
    <t3conv>1</t3conv>
  </lookindb>
</part>

After some debugging we found out that it's related to $_SERVER['QUERY_STRING']:

When processing a request, CoolURI first retrieves this value through GeneralUtility::getIndpEnv('QUERY_STRING'), and processes it. At this point $_SERVER['QUERY_STRING'] is still empty and only updated afterwards.

However, there is a runtime cache for GeneralUtility::getIndpEnv() since TYPO3 7.5, thus every subsequent call to GeneralUtility::getIndpEnv('QUERY_STRING') will return the original empty value.

And this brings us back to the menus: if you set addQueryString = 1, AbstractMenuContentObject::prepareMenuItemsForLanguageMenu() calls the ContentObjectRenderer::getQueryArguments() method which uses GeneralUtility::getIndpEnv('QUERY_STRING') if no method was specified (default) and thus gets the initial empty value.

To finalize everything: CoolURI should directly access $_SERVER['QUERY_STRING] and thus bypass the runtime cache of GeneralUtility::getIndpEnv(). There is a method GeneralUtility::flushInternalRuntimeCaches() but it's marked as @internal and should thus not be used here.

Our temporary workaround to fix the language menus is adding addQueryStringMethod = GET which then uses the uncached raw GET parameters.

Missing "exclude" attribute for field "tx_realurl_pathsegment" of "pages_language_overlay"

In ext_tables.php, the parameter "exclude" is missing for the field "tx_realurl_pathsegment" of "pages_language_overlay" in the TCA configuration:

$TCA['pages_language_overlay']['columns']['tx_realurl_pathsegment'] = array(
    'label' => 'LLL:EXT:cooluri/locallang_db.php:pages.tx_cooluri_pathsegment',
    'config' => array(
        'type' => 'input',
        'size' => '30',
        'max' => '30',
        'eval' => 'trim,nospace,lower',
    ),
);

1.1.4 regression: pages.is_siteroot must be set for each domain

Since 1.1.4 my multidomain URL paths aren't generated from the root of the current domain anymore but from TYPO3 root.

Every domain has it's own tree but starts about 5 levels deep from the TYPO3 root. The template record of each domain is set to "root" so the resulting URLs were like https://mydomain.com/mysub/mypage

Since 1.1.4 the URLs are like https://mydomain.com/hosting-folder/site-category/site-subcategory/mysub/mypage - working, but conveying unwanted information.

I copied the default pagepath config from the config xml example (cleaning cache and cooluri tables) which doesn't fix the issue. Temporary hotfix might be to set "remove from middle of page path to all category folder parent pages", but nevertheless this seems a to be a bug perhaps creating additional problems elsewhere.

Issue with combination of CoolURI, Multidomain and SSL/HTTPS

In the latest stable release (1.1.2) there is a problem when it comes to the combination of CoolURI, Multidomain and SSL/HTTPS. In "CoolUri.php", lines 322 and 471, the URL is preceeded statically by "http://", instead of checking if "https://" would be more appropriate. This behaviour has been described before here almost 6 years ago.

Typo3 7 LTS support

When trying to enable cooluri on Typo3 7 LTS I'm getting a 404 error when trying to access the pages with a correct cooluri link. The link is also available in the cooluri cache.

Reduce the amount of queries

Hey... the attached patch reduce the amount of queries. e.g. on my homepage 500 queries fewer :)
Please take a look into the simple internal cache...

patch.txt

Regards,
Tim

Cache Domain resolver

Speed up the page with many links....

diff --git a/typo3conf/ext/cooluri/class.tx_cooluri.php b/typo3conf/ext/cooluri/class.tx_cooluri.php
index 6f26ff8..3bcbe4c 100644
--- a/typo3conf/ext/cooluri/class.tx_cooluri.php
+++ b/typo3conf/ext/cooluri/class.tx_cooluri.php
@@ -349,6 +349,12 @@ class tx_cooluri

     public static function getDomain($id)
     {
+
+        static $domains = array();
+        if(isset($domains[$id]))
+            return $domains[$id];
+
+
         \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('Getting domain for ' . $id, 'CoolUri');
         if ($GLOBALS['TSFE']->showHiddenPage || self::isBEUserLoggedIn()) {
             $enable = ' AND pages.deleted=0';
@@ -369,6 +375,7 @@ class tx_cooluri
             if ($page['domainName'] && !$page['redirectTo']) {
                 $resDom = preg_replace('~^.*://(.*)/?$~', '\\1', preg_replace('~/$~', '', $page['domainName']));
                 \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('Resolved domain: ' . $resDom, 'CoolUri');
+                $domains[$id] = $resDom;
                 return $resDom;
             }

@@ -377,6 +384,7 @@ class tx_cooluri

             if ($count['num'] > 0 || $page['is_siteroot'] == 1) {
                 \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('Domain missing for ID ' . $id . ', using HTTP_HOST ' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_HOST'), 'CoolUri');
+                $domains[$id] = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_HOST');
                 return \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_HOST');
             }

@@ -385,6 +393,7 @@ class tx_cooluri
             --$max;
         }
         \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('Domain not found, using HTTP_HOST ' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_HOST'), 'CoolUri', 2);
+        $domains[$id] = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_HOST');
         return \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_HOST');
     }


Composer autoload

It would be great if the extension could include a composer file including autoload.

The generated URI can be different if it comes from cache

After having trouble with CoolUri and pagination of Solrfluid I started to debug.
Some hours later I was able to track down the missbehaviour.

The problem is, that the URL returned by params2cool can be different if it's coming from cache.
If the URI is not in cache the code looks like

$path = $this->saveInCache($uri->params,$path,$uri->originalparams,$updatecacheid,$cacheduri,$entityampersand);
return Functions::prepareforOutput($path,self::$conf).$this->transformParamsToQS($uri->params, $entityampersand);

If the URI is found in Cache only the cached value is returned. From my point of view the return value of Functions::prepareforOutput should be stored in the cache and then be returned.

CONCAT count same title - x (with subquery)

Hi bednee, I tried to make an counter for tt_news titles with the same name, in the "lookInDb" part of the cooluriconf.xml, like this way:

SELECT
    CONCAT(tt1.title, '-', tt2.uid, IF(tt2.number > 1, CONCAT('-', tt2.number), ''))

FROM
    tt_news as tt1,
    (
        SELECT
            uid,
            (@row_number:=@row_number +1) AS number

        FROM
            tt_news,
            (SELECT @row_number:=0) AS t

        WHERE
            title=(SELECT title FROM tt_news WHERE uid=$1)

    ) AS tt2

WHERE tt1.uid=$1;
<part>
    <parameter>tx_ttnews[tt_news]</parameter>
    <lookindb>
        <to>SELECT CONCAT(tt1.title, '-', tt2.uid, IF(tt2.number > 1, CONCAT('-', tt2.number), '')) FROM tt_news as tt1, (SELECT uid, (@row_number:=@row_number +1) AS number FROM tt_news, (SELECT @row_number:=0) AS t WHERE title=(SELECT title FROM tt_news WHERE uid=$1)) AS tt2 WHERE tt1.uid=$1</to>
        <t3conv>1</t3conv>
    </lookindb>
</part>

If I use this query in phpmyadmin, I get a list which I expected. Your SQL example, from the Extension Manual don't work too:

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

Please help :) What I doing wrong?
Greetings, Rob

Cooluri Typo3 8.7 can't create Tables

Compare current database with specification says:

CREATE TABLE link_cache (id INT UNSIGNED AUTO_INCREMENT NOT NULL, params BLOB DEFAULT NULL, url VARCHAR(255) DEFAULT NULL, tstamp DATETIME DEFAULT CURRENT_TIMESTAMP, crdatetime DATETIME DEFAULT NULL, sticky SMALLINT UNSIGNED DEFAULT 0, INDEX url (url(255)), INDEX params (params(255)), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB

CREATE TABLE link_oldlinks (id INT UNSIGNED AUTO_INCREMENT NOT NULL, link_id INT UNSIGNED DEFAULT 0 NOT NULL, url VARCHAR(255) DEFAULT NULL, tstamp DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, sticky SMALLINT UNSIGNED DEFAULT 0, UNIQUE INDEX id (id), INDEX url (url(255)), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB

after execute:
Database update failed
Error: Invalid default value for 'tstamp'

PHP-Version: 5.6.30
Mysql: 5.5.55
Typo3: 8.7.1

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.