Bug #14385
closed
HMENU special=language does not work if L in linkvars
Added by old_pneff over 19 years ago.
Updated almost 18 years ago.
Description
The 3.7 language menu generates a faulty URL for language switch. When rendering a page with the L querystring in the URL (e.g. index.php?id=10&L=2), the links in the language menu contain two L query strings (e.g. index.php?id=10&L=2&L=1).
This seems to happend only then L is in config.linkVars.
I have created a small patch which fixes the problem. Basically it removes the existing L parameter from $GLOBALS['TSFE']->linkVars before rendering the language menu. This is probably fault, because it would at least have to backup $GLOBALS['TSFE']->linkVars and set it back to the backuped value after the menu is generated (I'm really just guessing here).
(issue imported from #M490)
Files
i'd suggest to integrate the tt_news language_menu.php.. which solves problems with the GETvars, simulateStatics and realURL (also Satan's extesion does the same.. )
ops... i didn't absolutely wanted to write "Satan's"!!!
what a type-mistake :):)
maybe i wanted to write "Stan's" (referring to sr_language_menu ) :):)
ps: i'm absomutely not involved with any Satanic stuff aha ha ahah..
The new patch uploaded by fhengartner fixes a problem with my first approach. Can we hope to see this problem fixed anytime soon?
No, I think the correction has to be done in class.t3lib_tstemplate.php, function linkData - Line 1326:
$LD['linkVars'] = $GLOBALS['TSFE']->linkVars.$addParams;
if '&L=' is included in $addParams, then the corresponding '&L=' in
$LD['linkVars'] must be replaced.
Something like:
$LD['linkVars'] = ..removeDoubleParam($GLOBALS['TSFE']->linkVars).
$addParams;
-
Stefan Geith, typo3dev(at)geithware.de
The solution:
in class.t3lib_tstemplate.php, replace lines
1325 // linkVars
1326 $LD['linkVars'] = $GLOBALS['TSFE']->linkVars.$addParams;
with:
// linkVars
$lV = Array();
$tmp = explode ('&',$GLOBALS['TSFE']->linkVars);
while(list($k,$e)=each($tmp)) if ($e) {
list($k,$v) = explode('=',$e);
$lV[$k] = $v;
}
$tmp = explode ('&',$addParams);
while(list($k,$e)=each($tmp)) if ($e) {
list($k,$v) = explode('=',$e);
$lV[$k] = $v;
}
$LD['linkVars'] = t3lib_div::implodeArrayForUrl('',$lV);
the fix from Stefan is working for me. I made a diff file from it and atached it to this bug.
the other patchfiles (13.11.04 and 09.02.05 ) are not working at all -> nothing changes
(tested on 3.7.0 and 3.8.0 dev)
Removed two diff attachments because they did not really solve the problem!
I just replied to Stefan Geiths post in typo3-dev:
If you are still interested to have this fixed, please write a new patch based on the diff by Rupi which solves the problem.
Please add the requested config options and submit it on the bugtracker including some additional TSref description lines.
- michael
I added a new patch which does the same as before, but now the use of the fix is configurable.
config.uniqueLinkVars = 1
will enable it.
Thanks, Rupi. Will do that and confirm when done.
the patch named (class.t3lib_tstemplate_3.diff) should need not so much processing time as the patches before.
I reduced it to 1 while loop and added a condition that ckecks if '$addParams' has a value before doing anything. This executes the the 'parameter-cleaning' only for the links from the language menu.
IMO the additional config parameter 'uniqueLinkVars' is now not needed anymore because the additional processing is only done with a few links. (I added this as patch class.t3lib_tstemplate_4.diff)
what so you think ?
Hmm, finally found where this information belongs to (previously posted it in the wrong bug entry by mistake)
====
Kasper wrote:
- I wouild like the explode function to us ",2" as third parameter -
just to make sure it splits on only the first found "=". Only a
theoretical thing.
I agree with this. Changed it already on my local copy of the patch, so this is just for your information.
====
I'm still waiting for Kaspers go but think it should be fine to add it like you suggested in the patch which enables the feature by default (= no config option).
Also available in: Atom
PDF