Bug #28640
closedTMENU_LAYERS does not always create unique IDs for the third level
0%
Description
TMENU_LAYERS creates not unique IDs, if I use 2 TMENU_LAYERS menues.
Example:
temp.MENU_MAIN = HMENU
temp.MENU_MAIN {
entryLevel = 1
}
temp.MENU_MAIN.1 = TMENU_LAYERS
temp.MENU_MAIN.1 {
layerStyle = position:absolute;visibility:hidden;
lockPosition = x
...
}
temp.MENU_MAIN.2 = TMENU_LAYERS
temp.MENU_MAIN.2 {
layerStyle = position:absolute;visibility:hidden;
lockPosition = y
...
}
temp.MENU_MAIN.3 = TMENU
temp.MENU_MAIN.3 {
...
}
The IDs for the third level are not unique, if there are more entries/layers to display in the second and third level.
Example for the third level:
<div id="Menu1e532b0" style="z-index:9995; position:absolute;visibility:hidden;"><div class="menu1_main2"><a href="archiv.html" title="Archiv" onfocus="blurLink(this);">Archiv</a></div></div>
<div id="Menu1e532b0" style="z-index:9993; position:absolute;visibility:hidden;"><div class="menu1_main2"><a href="meldungen1.html" title="Meldungen" onfocus="blurLink(this);">Meldungen</a></div></div>
<div id="Menu1e532b1" style="z-index:9992; position:absolute;visibility:hidden;"><div class="menu1_main2"><a href="meldungen2.html" title="Meldungen" onfocus="blurLink(this);">Meldungen</a></div></div>
I have found a solution to fix this bug. The WMid makes the problems.
File: typo3/sysext/cms/tslib/media/scripts/tmenu_layers.php
The value for "$this->WMid" should contain more values.
I dont know which values so I have added a rand:
function extProc_init() {
$this->WMid = trim($this->mconf['layer_menu_id']) ? trim($this->mconf['layer_menu_id']).rand(0,99) . 'x' : substr(md5('gl' . serialize($this->mconf)), 0, 6).rand(0,99);
Note: the problem occurs not always. Some typo3 installations generate always a correct WMid.
Updated by Björn Pedersen over 13 years ago
why don't you just use the "layer_menu_id" property of TMENU_LAYER to get unique names?
Otherwise it seems to be the same as http://forge.typo3.org/issues/24367.
Updated by Björn Pedersen over 13 years ago
Looking at the related bug reports, I think using rand is a bad idea ( the problem was introduced when removing the use of microtime that caused a flooding by temp-files).
Probably the menu items should get enumerated and the enumeration used as part of the id.
Updated by Kurt Gusbeth over 13 years ago
Björn Pedersen wrote:
why don't you just use the "layer_menu_id" property of TMENU_LAYER to get unique names?
I have tried "layer_menu_id" like described here:
http://www.typo3.net/tsref/menu_objects/gmenu_layers/
The "layer_menu_id" is valid for a whole level so the WMid is always the same.
Updated by Philipp Gampe over 13 years ago
IMHO TMENU_LAYERS should be deprecated instead of wasting time into it.
You can create much better menus with TMENU+CSS.
Updated by Thorsten Kahler over 13 years ago
- Category set to Content Rendering
- Status changed from New to Needs Feedback
Kurt, can you reproduce this on older TYPO3 versions too?
Updated by Kurt Gusbeth over 13 years ago
Thorsten Kahler wrote:
Kurt, can you reproduce this on older TYPO3 versions too?
Yes. I have this problem with Typo3 4.4.6 too.
Updated by Kurt Gusbeth about 13 years ago
If no layer_menu_id is given, the WMid will be generated like this:
substr(md5('gl' . serialize($this->mconf)), 0, 6);
It depends only on $this->mconf.
print_r($this->mconf) tells me this:
Array ( [layerStyle] => position:absolute;visibility:hidden; [lockPosition] => y [relativeToParentLayer] => 1 [relativeToTriggerItem] => 1 [topOffset] => 0 [leftOffset] => 175 [hideMenuWhenNotOver] => 100 [hideMenuTimer] => 100 [expAll] => 1 [wrap] => <div class="menu1_main2_table">|</div> [NO.] => Array ( [allWrap] => <div class="menu1_main2"> | </div> [ATagTitle.] => Array ( [field] => title ) ) [ACT] => 1 [ACT.] => Array ( [allWrap] => <div class="menu1_main2_act"> | </div> ) [IFSUB] => 1 [IFSUB.] => Array ( [allWrap] => <div class="menu1_main2_sub"> | </div> ) )
$this->mconf is always the same for every menu of the third level.
Thats the reason why $this->WMid is always the same too => not unique IDs.
Updated by Kurt Gusbeth about 13 years ago
A better solution: replace rand(0,99) with this:
$GLOBALS['TSFE']->register['count_HMENU_MENUOBJ']
Updated by Chris topher about 13 years ago
- Subject changed from TMENU_LAYERS creates not always unique IDs for the third level to TMENU_LAYERS does not always create unique IDs for the third level
Updated by Chris topher about 13 years ago
- Target version changed from 4.6.0 to 4.6.1
Updated by Chris topher almost 13 years ago
- Target version changed from 4.6.1 to 4.6.2
Updated by Xavier Perseguers almost 13 years ago
- Target version deleted (
4.6.2)
Updated by Christian Kuhn over 11 years ago
- Status changed from Needs Feedback to Rejected
With 6.1 issue #46358, the _layers menus where moved to statictemplates, and statictemplates was removed from core afterwards. This issue won't be solved in the core anymore.