[TYPO3-core] RFC: typolink .addQueryString fix
Bernhard Kraft
kraftb at kraftb.at
Sat Apr 1 23:45:08 CEST 2006
Hello,
This is an CVS patch request.
Type: bugfix
Description:
By using the typolink property.
.addQueryString:
---
Add the QUERY_STRING to the start of the link. Notice that this does not check for any duplicate
parameters! This is not a problem (only the last parameter of the same name will be applied), but
enable "config.uniqueLinkVars" if you still don't like it.
----
You can add the actual parameters to the generated typolink.
Problem:
If the query-parameters are multidimensional like:
tx_whatever[single]=12&tx_whatever[page]=3
then the bottom lines of tslib_content.php method "getQueryArguments":
----
$content = '';
foreach ($q_out as $k => $v) {
$content .= '&'.$k.'='.($rawValues ? $v : rawurlencode($v));
}
return $content;
---
will fail with a php error complaining that php can't realurlencode an array (which $v is).
you have to set:
typolink.addQueryString.method = GET
or "POST" for this to work. Else it fetches it's content's from elsewhere.
Solution:
Obvious. Use "t3lib_div::implodeArrayForUrl" instead of NO API-Call at all.
the change:
--------------------
diff -u -ru typo3_src-4.0rc2/typo3/sysext/cms/tslib/class.tslib_content.php typo3_src-4.0rc.mod/typo3/sysext/cms/tslib/class.tslib_content.php
--- typo3_src-4.0rc2/typo3/sysext/cms/tslib/class.tslib_content.php 2006-03-26 22:22:16.000000000 +0200
+++ typo3_src-4.0rc.mod/typo3/sysext/cms/tslib/class.tslib_content.php 2006-04-01 22:44:22.617838352 +0200
@@ -5548,9 +5548,7 @@
}
$content = '';
- foreach ($q_out as $k => $v) {
- $content .= '&'.$k.'='.($rawValues ? $v : rawurlencode($v));
- }
+ $content .= t3lib_div::implodeArrayForUrl('', $q_out);
return $content;
}
~
--------------------
greets,
Bernhard
--
----------------------------------------------------------------------
"Freiheit ist immer auch die Freiheit des Andersdenkenden"
Rosa Luxemburg, 1871 - 1919
----------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: addQueryString_implodeArrayForUrl_2006-04-01.diff
Type: text/x-patch
Size: 589 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20060401/09f37035/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20060401/09f37035/attachment.pgp
More information about the TYPO3-team-core
mailing list